forked from CleverTap/CleverTap-Lokalise-Connector
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile
66 lines (53 loc) · 1.57 KB
/
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
60
61
62
63
64
65
66
# ---- Base Node ----
FROM node:20.11.1-bookworm-slim as base
RUN set -ex;\
apt-get update -y; \
apt-get install -y --no-install-recommends libssl3; \
rm -rf /var/lib/apt/lists/*;
RUN mkdir -p /home/node/app
RUN chown -R node:node /home/node && chmod -R 770 /home/node
WORKDIR /home/node/app
# ---- Dependencies ----
FROM base AS dependencies
RUN set -ex; \
apt-get update -y ; \
apt-get install -y --no-install-recommends \
ca-certificates \
dumb-init \
make \
gcc \
g++ \
python3 \
git \
openssl
COPY --chown=node:node ./package.json ./package.json
COPY --chown=node:node ./package-lock.json ./package-lock.json
USER node
# install production dependencies
RUN set -ex; \
npm ci --ignore-scripts
# separate production node_modules
RUN cp -R node_modules prod_node_modules
# install ALL node_modules, including 'devDependencies'
RUN set -ex; \
npm install --ignore-scripts
# ---- Build ----
FROM dependencies as build
COPY --chown=node:node . .
RUN npm run build
# ---- App ----
FROM base as app
COPY --chown=node:node --from=build /home/node/app/dist .
COPY --chown=node:node --from=build /home/node/app/prod_node_modules node_modules
# ---- Rrelase ----
FROM base as release
COPY --from=build /usr/bin/dumb-init /usr/bin/dumb-init
COPY --chown=node:node --from=app /home/node/app /home/node/app
ARG GIT_COMMIT_SHA=""
ARG APP_VERSION=""
ENV GIT_COMMIT_SHA=${GIT_COMMIT_SHA}
ENV APP_VERSION=${APP_VERSION}
ENV NODE_ENV=production
ENV NODE_PATH=.
USER node
CMD [ "dumb-init", "node", "/home/node/app/src/server.js" ]