diff --git a/.dockerignore b/.dockerignore index 0f8abf9..7935cf4 100644 --- a/.dockerignore +++ b/.dockerignore @@ -1,7 +1,17 @@ -node_modules -.next -.turbo -.git -*.log +# Ignore everything by default +* -docker/backups +# Allow only what the Dockerfile needs +!package.json +!pnpm-lock.yaml +!pnpm-workspace.yaml +!turbo.json +!.npmrc +!apps/web/ +!packages/ + +# Re-exclude build artifacts that snuck in +apps/web/.next +apps/web/node_modules +packages/*/node_modules +packages/*/dist diff --git a/docker/Dockerfile b/docker/Dockerfile index fa14f41..8b02c9b 100644 --- a/docker/Dockerfile +++ b/docker/Dockerfile @@ -15,12 +15,14 @@ RUN turbo prune @advdoors/web --docker FROM base AS builder COPY --from=pruner /app/out/json/ . COPY --from=pruner /app/out/pnpm-lock.yaml ./pnpm-lock.yaml -RUN pnpm install --frozen-lockfile +RUN --mount=type=cache,id=pnpm,target=/pnpm/store \ + pnpm install --frozen-lockfile # Copy pruned source and build via Turbo COPY --from=pruner /app/out/full/ . ENV NEXT_TELEMETRY_DISABLED=1 -RUN pnpm turbo build --filter=@advdoors/web +RUN --mount=type=cache,target=/app/apps/web/.next/cache \ + pnpm turbo build --filter=@advdoors/web # Production FROM base AS runner