synclounge/Dockerfile

39 lines
1.0 KiB
Docker
Raw Normal View History

# build environment
FROM --platform=$BUILDPLATFORM node:20.8.1-alpine3.18 as build-stage
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++
USER node
COPY --link --chown=1000:1000 package*.json ./
RUN SKIP_BUILD=true npm ci
COPY --link --chown=1000:1000 . .
2020-07-21 02:27:43 +00:00
ARG VERSION
2020-07-24 21:25:45 +00:00
2020-07-21 00:01:07 +00:00
RUN npm run build
# dependency environment
FROM node:20.8.1-alpine3.18 as dependency-stage
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++
USER node
COPY --link --chown=1000:1000 package*.json ./
RUN SKIP_BUILD=true npm ci
RUN npm prune --production
2020-07-23 23:40:45 +00:00
# production environment
FROM node:20.8.1-alpine3.18 as production-stage
RUN mkdir /app && chown -R node:node /app
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
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-10-13 23:25:30 +00:00
ENTRYPOINT ["/sbin/tini", "--"]
CMD ["/app/server.js"]