2022-02-07 22:06:30 +01:00
|
|
|
##################################
|
|
|
|
# DEVELOPMENT
|
|
|
|
##################################
|
2022-02-10 03:48:06 +01:00
|
|
|
FROM node:16-alpine3.14 AS development
|
2022-02-03 21:42:27 +01:00
|
|
|
|
|
|
|
ARG DEBIAN_FRONTEND=noninteractive
|
|
|
|
|
|
|
|
WORKDIR /usr/src/app
|
|
|
|
|
2022-02-07 22:06:30 +01:00
|
|
|
COPY package.json package-lock.json ./
|
2022-02-03 21:42:27 +01:00
|
|
|
|
2022-03-22 08:13:16 +01:00
|
|
|
RUN apk add --update-cache build-base python3
|
2022-02-03 21:42:27 +01:00
|
|
|
|
2022-02-07 22:06:30 +01:00
|
|
|
RUN npm install
|
2022-02-03 21:42:27 +01:00
|
|
|
|
|
|
|
COPY . .
|
|
|
|
|
2022-02-07 22:06:30 +01:00
|
|
|
RUN npm run build
|
2022-02-03 21:42:27 +01:00
|
|
|
|
2022-02-11 03:40:11 +01:00
|
|
|
#################################
|
2022-02-07 22:06:30 +01:00
|
|
|
# PRODUCTION
|
2022-02-11 03:40:11 +01:00
|
|
|
#################################
|
|
|
|
FROM node:16-alpine3.14 AS production
|
2022-02-03 21:42:27 +01:00
|
|
|
|
2022-02-11 03:40:11 +01:00
|
|
|
ARG DEBIAN_FRONTEND=noninteractive
|
|
|
|
ARG NODE_ENV=production
|
|
|
|
ENV NODE_ENV=${NODE_ENV}
|
2022-02-03 21:42:27 +01:00
|
|
|
|
2022-02-11 03:40:11 +01:00
|
|
|
WORKDIR /usr/src/app
|
2022-02-03 21:42:27 +01:00
|
|
|
|
2022-02-11 03:40:11 +01:00
|
|
|
COPY package.json package-lock.json ./
|
2022-02-03 21:42:27 +01:00
|
|
|
|
2022-03-22 08:13:16 +01:00
|
|
|
RUN apk add --update-cache build-base python3
|
2022-02-07 22:06:30 +01:00
|
|
|
|
2022-02-11 03:40:11 +01:00
|
|
|
RUN npm install --only=production
|
2022-02-07 22:06:30 +01:00
|
|
|
|
2022-02-11 03:40:11 +01:00
|
|
|
COPY . .
|
2022-02-03 22:27:31 +01:00
|
|
|
|
2022-02-11 03:40:11 +01:00
|
|
|
COPY --from=development /usr/src/app/dist ./dist
|
2022-02-03 22:27:31 +01:00
|
|
|
|
2022-02-11 03:40:11 +01:00
|
|
|
CMD ["node", "dist/main"]
|