generated from kalisio/skeleton
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdockerfile
41 lines (32 loc) · 983 Bytes
/
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
FROM node:16-bullseye-slim as Builder
LABEL maintainer="contact@kalisio.xyz"
ARG FLAVOR
ARG BUILD_NUMBER
ENV BUILD_NUMBER=$BUILD_NUMBER
ENV NODE_APP_INSTANCE=$FLAVOR
# Copy the built artefact.
# Warning -
# We could do ADD and let Docker uncompress automatically the archive but we reach log limit in Travis.
# So we copy the archive and uncompress it using tar without the verbose mode
COPY kalisio.tgz /opt/.
WORKDIR /opt
RUN tar zxf kalisio.tgz && rm kalisio.tgz
# Link the modules and run the app
# Use multisage build to forget the unused archive.tgz
FROM node:16-bullseye-slim
LABEL maintainer="contact@kalisio.xyz"
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
# Link the modules
WORKDIR /opt/kalisio
RUN node . ${APP}.js --link
# Run the app
WORKDIR /opt/kalisio/${APP}
EXPOSE 8081
CMD [ "yarn", "prod" ]