Skip to content

Modern Docker Management, Designed for Everyone

chore: consolidate COPY commands in Dockerfile and Dockerfile.dev for improved efficiency

Kyle Mendell9d44e112ba0a
diff --git a/docker/Dockerfile b/docker/Dockerfile
index e846840ba..20c3b8757 100644
--- a/docker/Dockerfile
+++ b/docker/Dockerfile
@@ -7,10 +7,8 @@ FROM --platform=$BUILDPLATFORM ghcr.io/voidzero-dev/vite-plus:latest AS frontend
ENV CI=true
WORKDIR /app
-COPY --chown=vp:vp pnpm-lock.yaml pnpm-workspace.yaml package.json ./
-COPY --chown=vp:vp frontend/package.json ./frontend/package.json
-COPY --chown=vp:vp tests/package.json ./tests/package.json
-COPY --chown=vp:vp email-templates/package.json ./email-templates/package.json
+COPY --chown=vp:vp --parents pnpm-lock.yaml pnpm-workspace.yaml package.json \
+ frontend/package.json tests/package.json email-templates/package.json ./
RUN --mount=type=cache,id=arcane-pnpm-v3,target=/home/vp/.local/share/pnpm/store,sharing=locked,uid=1000,gid=1000 \
vp install --frozen-lockfile --prefer-offline --filter ./frontend...
diff --git a/docker/Dockerfile.dev b/docker/Dockerfile.dev
index cf4daeb32..141b8ed7e 100644
--- a/docker/Dockerfile.dev
+++ b/docker/Dockerfile.dev
@@ -8,10 +8,8 @@ ENV CI=true
WORKDIR /app
# Copy dependency manifests first to preserve the install layer cache
-COPY --chown=vp:vp pnpm-lock.yaml pnpm-workspace.yaml package.json ./
-COPY --chown=vp:vp frontend/package.json ./frontend/package.json
-COPY --chown=vp:vp tests/package.json ./tests/package.json
-COPY --chown=vp:vp email-templates/package.json ./email-templates/package.json
+COPY --chown=vp:vp --parents pnpm-lock.yaml pnpm-workspace.yaml package.json \
+ frontend/package.json tests/package.json email-templates/package.json ./
# Install dependencies with a persistent package store cache
RUN mkdir -p /home/vp/.local/share/pnpm/store