Skip to content

Commit

Permalink
chore: update docker file
Browse files Browse the repository at this point in the history
  • Loading branch information
kenso312 committed Sep 24, 2022
1 parent 2c8eed4 commit 54305f7
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 8 deletions.
13 changes: 8 additions & 5 deletions ci/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,24 +1,27 @@
ARG WORKDIR=/opt/app

# Base Stage: Upgrade npm and install / upgrade pnpm
FROM node:16.17-alpine3.15 AS base
RUN npm i -g pnpm
LABEL builder=true
RUN npm i -g npm pnpm

# Install dependencies only when needed
# Dependencies Stage: Copy package.json + lock file and install dependencies
FROM base as dependencies
ARG WORKDIR
WORKDIR ${WORKDIR}
COPY package.json pnpm-lock.yaml ./
RUN pnpm install
# Skip pnpm checking + Husky init
RUN pnpm install --ignore-scripts

# Rebuild the source code only when needed
# Builder Stage: Copy node_modules from dependencies and build it
FROM base as builder
ARG WORKDIR
WORKDIR ${WORKDIR}
COPY . .
COPY --from=dependencies ${WORKDIR}/node_modules node_modules
RUN pnpm build

# Production image, copy all the files and run next
# Production Stage: Copy dist and package.json from builder and start the application
FROM base as runner
ARG WORKDIR
WORKDIR ${WORKDIR}
Expand Down
6 changes: 3 additions & 3 deletions ci/docker-compose.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# For local testing docker environment
# docker build . -t "nestjs-v9-webpack-boilerplate:latest" -f ci/Dockerfile
# docker-compose -p "nftiv" -f ci/docker-compose.yaml up
# Useful Command:
# docker build . -t nestjs-v9-webpack-boilerplate:latest -f ci/Dockerfile
# docker-compose -p nest -f ci/docker-compose.yaml up

version: '3.9'

Expand Down

0 comments on commit 54305f7

Please sign in to comment.