Skip to content

Commit

Permalink
Document Dockerfile and caching logic
Browse files Browse the repository at this point in the history
I assume that package.json changes should invalidate the cache for the early copy

Signed-off-by: Stefan Marr <git@stefan-marr.de>
  • Loading branch information
smarr committed Mar 23, 2024
1 parent 324f937 commit a01269b
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -15,15 +15,15 @@ RUN apt-get update && apt-get install -y \
libfontconfig1-dev \
libpq-dev

# Copy only package.json to enable caching
COPY ./package.json ./package-lock.json /project/
# Copy only package*.json, which are likely unchanged, allowing caching
COPY package.json package-lock.json /project/

# Set the working dir to the project & install and compile all dependency
WORKDIR /project/

RUN SKIP_COMPILE=true npm ci --ignore-scripts=false --foreground-scripts

# all of the project files will be copyed to a new dir called project
COPY . /project
# copy all files, which likely have changed, and prevent caching
COPY . /project/

RUN npm run compile

0 comments on commit a01269b

Please sign in to comment.