Skip to content

Your favorite shift management application!

feat: optimize Docker build process by caching npm dependencies and restrict Docker platforms to linux/amd64

panteLxcdedd21e786e
diff --git a/.github/workflows/docker-publish.yml b/.github/workflows/docker-publish.yml
index 4b42a2f..e86d86b 100644
--- a/.github/workflows/docker-publish.yml
+++ b/.github/workflows/docker-publish.yml
@@ -56,7 +56,7 @@ jobs:
uses: docker/build-push-action@v5
with:
context: .
- platforms: linux/amd64,linux/arm64
+ platforms: linux/amd64
push: ${{ github.event_name != 'pull_request' }}
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
diff --git a/Dockerfile b/Dockerfile
index f8595c3..c955e1d 100644
--- a/Dockerfile
+++ b/Dockerfile
@@ -6,8 +6,10 @@ RUN apk add --no-cache libc6-compat python3 make g++
WORKDIR /app
# Copy package files and install ALL dependencies
+# These layers are cached unless package files change
COPY package.json package-lock.json ./
-RUN npm ci
+RUN --mount=type=cache,target=/root/.npm \
+ npm ci
# Copy source code
COPY . .
@@ -37,7 +39,8 @@ COPY --from=builder /app/drizzle.config.ts ./drizzle.config.ts
# Install only production dependencies (including drizzle-kit now)
COPY --from=builder /app/package-lock.json ./package-lock.json
-RUN npm ci --only=production
+RUN --mount=type=cache,target=/root/.npm \
+ npm ci --only=production
# Create data directory for SQLite database
RUN mkdir -p /app/data