Skip to content

Commit

Permalink
build(docker): only copy required files
Browse files Browse the repository at this point in the history
'COPY .' causes cache invalidation when any file within the repo is changed, whether they affect the build steps or not.
This means that, locally, layers constantly have to be rebuilt. Instead, this copies the files required at that step.

Refs #390
  • Loading branch information
thewilkybarkid committed Jul 27, 2021
1 parent 7cca910 commit 1bd9c73
Showing 1 changed file with 15 additions and 6 deletions.
21 changes: 15 additions & 6 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,15 @@ COPY ./package* ./

RUN npm ci

COPY . .

ENV NODE_ENV=production

# Avoid lscpu warning on Alpine
#ENV PARCEL_WORKERS=1
COPY \
.parcelrc \
.prettierignore \
.prettierrc \
.sassrc \
.terserrc \
tsconfig.json \
./
COPY src/ src/

RUN npm run build

Expand All @@ -33,6 +36,12 @@ RUN npm run build
FROM build AS dev
ENV NODE_ENV=development

COPY \
.gitignore \
.proxyrc \
docker-entrypoint.sh \
./

ENTRYPOINT ["./docker-entrypoint.sh"]
CMD ["start:dev"]

Expand Down

0 comments on commit 1bd9c73

Please sign in to comment.