1
0
Fork 0
mirror of https://github.com/codex-team/codex.docs.git synced 2025-07-18 20:59:42 +02:00

Docker image optimization (#150)

This commit is contained in:
Nikita Melnikov 2022-03-06 13:37:06 +04:00 committed by GitHub
parent 8d9c19e595
commit c6e2db0245
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
15 changed files with 167 additions and 2359 deletions

View file

@ -1,7 +1,7 @@
FROM node:16.14.0-alpine3.15
# Stage 1 - build
FROM node:16.14.0-alpine3.15 as build
WORKDIR /usr/src/app
RUN apk add --no-cache git gcc g++ python3 make musl-dev
COPY package.json yarn.lock ./
@ -9,6 +9,22 @@ RUN yarn install
COPY . .
RUN yarn build
RUN yarn compile
CMD ["yarn", "start:ts"]
# Stage 2 - make final image
FROM node:16.14.0-alpine3.15
WORKDIR /usr/src/app
COPY package.json yarn.lock ./
RUN yarn install --production
COPY --from=build /usr/src/app/dist ./dist
COPY --from=build /usr/src/app/public ./public
ENV NODE_ENV=production
CMD ["node", "dist/bin/server.js"]