forked from eritislami/evobot
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile
32 lines (22 loc) · 789 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
ARG NODE_VERSION=18.18.2-slim
FROM node:${NODE_VERSION} as base
ENV USER=evobot
RUN apt-get update && \
apt-get install -y --no-install-recommends python3 build-essential && \
apt-get purge -y --auto-remove && \
rm -rf /var/lib/apt/lists/*
RUN groupadd -r ${USER} && \
useradd --create-home --home /home/evobot -r -g ${USER} ${USER}
USER ${USER}
WORKDIR /home/evobot
FROM base as build
COPY --chown=${USER}:${USER} . .
RUN npm ci
RUN npm run build
RUN rm -rf node_modules && \
npm ci --omit=dev
FROM node:${NODE_VERSION} as prod
COPY --chown=${USER}:${USER} package*.json ./
COPY --from=build --chown=${USER}:${USER} /home/evobot/node_modules ./node_modules
COPY --from=build --chown=${USER}:${USER} /home/evobot/dist ./dist
CMD [ "node", "./dist/index.js" ]