2020-09-01 00:05:56 +00:00
|
|
|
# build environment
|
2023-10-17 11:08:54 +00:00
|
|
|
FROM --platform=$BUILDPLATFORM node:20.8.1-alpine3.18 as build-stage
|
2020-08-24 01:08:44 +00:00
|
|
|
RUN mkdir /app && chown -R node:node /app
|
2020-07-21 00:01:07 +00:00
|
|
|
WORKDIR /app
|
2020-09-19 20:14:33 +00:00
|
|
|
RUN apk add --no-cache python3 make g++
|
2020-08-31 23:24:45 +00:00
|
|
|
USER node
|
2023-09-25 23:11:43 +00:00
|
|
|
COPY --link --chown=1000:1000 package*.json ./
|
2020-08-31 22:55:14 +00:00
|
|
|
RUN SKIP_BUILD=true npm ci
|
2023-09-25 23:11:43 +00:00
|
|
|
COPY --link --chown=1000:1000 . .
|
2020-07-21 02:27:43 +00:00
|
|
|
|
2020-08-30 20:05:37 +00:00
|
|
|
ARG VERSION
|
2020-07-24 21:25:45 +00:00
|
|
|
|
2020-07-21 00:01:07 +00:00
|
|
|
RUN npm run build
|
|
|
|
|
2020-08-24 01:26:06 +00:00
|
|
|
# dependency environment
|
2023-10-17 11:08:54 +00:00
|
|
|
FROM node:20.8.1-alpine3.18 as dependency-stage
|
2020-09-01 00:05:56 +00:00
|
|
|
RUN mkdir /app && chown -R node:node /app
|
|
|
|
WORKDIR /app
|
2020-09-19 20:14:33 +00:00
|
|
|
RUN apk add --no-cache python3 make g++
|
2020-09-01 00:05:56 +00:00
|
|
|
USER node
|
2023-09-25 23:11:43 +00:00
|
|
|
COPY --link --chown=1000:1000 package*.json ./
|
2020-09-01 00:05:56 +00:00
|
|
|
RUN SKIP_BUILD=true npm ci
|
2020-08-31 23:24:45 +00:00
|
|
|
RUN npm prune --production
|
2020-08-24 01:08:44 +00:00
|
|
|
|
2020-07-23 23:40:45 +00:00
|
|
|
# production environment
|
2023-10-17 11:08:54 +00:00
|
|
|
FROM node:20.8.1-alpine3.18 as production-stage
|
2020-08-24 01:08:44 +00:00
|
|
|
RUN mkdir /app && chown -R node:node /app
|
2020-08-21 01:32:23 +00:00
|
|
|
WORKDIR /app
|
2020-10-13 23:25:30 +00:00
|
|
|
RUN apk add --no-cache tini
|
2020-10-13 23:27:51 +00:00
|
|
|
|
|
|
|
USER node
|
2023-09-25 23:11:43 +00:00
|
|
|
COPY --link --chown=1000:1000 server.js .
|
|
|
|
COPY --link --chown=1000:1000 config config
|
|
|
|
COPY --link --chown=1000:1000 --from=dependency-stage /app/node_modules node_modules
|
|
|
|
COPY --link --chown=1000:1000 --from=build-stage /app/dist dist
|
2020-08-21 01:32:23 +00:00
|
|
|
|
2020-10-13 23:25:30 +00:00
|
|
|
ENTRYPOINT ["/sbin/tini", "--"]
|
2020-11-19 02:18:30 +00:00
|
|
|
CMD ["/app/server.js"]
|