-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathapp.Dockerfile
59 lines (43 loc) · 1.24 KB
/
app.Dockerfile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
ARG DEBIAN_VERSION=bookworm
ARG NODE_VERSION=20
## Use a builder
##
FROM node:${NODE_VERSION}-${DEBIAN_VERSION}-slim as builder
LABEL maintainer="[email protected]"
# git is required to pull some node packages from github
RUN DEBIAN_FRONTEND=noninteractive && \
apt-get update && \
apt-get --no-install-recommends --yes install \
ca-certificates git
COPY . /opt/kalisio
# Setup kli
WORKDIR /opt/kalisio/kli
RUN yarn install
ARG APP
ARG FLAVOR
ARG BUILD_NUMBER
ENV BUILD_NUMBER=$BUILD_NUMBER
ENV NODE_APP_INSTANCE=$FLAVOR
# Setup app & cleanup workspace
WORKDIR /opt/kalisio/
RUN \
node /opt/kalisio/kli/index.js /opt/kalisio/kli.js --install && \
node /opt/kalisio/kli/index.js /opt/kalisio/kli.js --link --link-folder /opt/kalisio/yarn-links && \
cd /opt/kalisio/$APP && yarn pwa:build && \
rm -fR /opt/kalisio/kli /opt/kalisio/kli.js
## Copy to final container
##
FROM node:${NODE_VERSION}-${DEBIAN_VERSION}-slim
LABEL maintainer="[email protected]"
ARG APP
ARG FLAVOR
ARG BUILD_NUMBER
ENV BUILD_NUMBER=$BUILD_NUMBER
ENV NODE_APP_INSTANCE=$FLAVOR
COPY --from=Builder --chown=node:node /opt/kalisio /opt/kalisio
# From now on, run stuff as 'node'
USER node
# Run the app
EXPOSE 8081
WORKDIR /opt/kalisio/$APP
CMD [ "yarn", "prod" ]