-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDockerfile
47 lines (32 loc) · 863 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
42
43
44
45
46
47
ARG USER=vbot
ARG APP_DIR=/home/${USER}/app
ARG NODE_VERSION=18
# build stage
FROM docker.io/library/node:${NODE_VERSION} AS builder
ARG USER
ARG APP_DIR
RUN useradd "$USER" --create-home;
RUN mkdir -p "$APP_DIR"; \
chown "$USER" "$APP_DIR"; \
chown "$USER" /usr/local/lib/node_modules;
WORKDIR ${APP_DIR}
COPY package*.json ${APP_DIR}/
RUN npm clean-install
COPY . ${APP_DIR}/
RUN npm run build
# run stage
FROM docker.io/library/node:${NODE_VERSION} as runner
LABEL maintainer="[email protected]"
ARG USER
ARG APP_DIR
RUN useradd "$USER" --create-home;
WORKDIR ${APP_DIR}
COPY --from=builder ${APP_DIR} ${APP_DIR}/
RUN npm clean-install --omit=dev
ENV MIKRO_ORM_CACHE_DIR=/tmp/mikroorm-cache
ARG PORT=3000
EXPOSE $PORT/tcp
ENV PORT $PORT
USER ${USER}
CMD npm run start:prod
# HEALTHCHECK CMD curl --fail localhost:${PORT}/health || exit 1