Update Dofckerfile sveltekit node.md
This commit is contained in:
parent
7998cf8f55
commit
830e43b810
|
@ -1,8 +1,3 @@
|
||||||
This Dockerfile maximizes layer caching through `pnpm fetch` and multi-step dependencies installation.
|
|
||||||
|
|
||||||
See https://pnpm.io/docker#example-3-build-on-cicd
|
|
||||||
|
|
||||||
```dockerfile
|
|
||||||
FROM node:22-alpine AS base
|
FROM node:22-alpine AS base
|
||||||
ENV PNPM_HOME="/pnpm"
|
ENV PNPM_HOME="/pnpm"
|
||||||
ENV PATH="$PNPM_HOME:$PATH"
|
ENV PATH="$PNPM_HOME:$PATH"
|
||||||
|
@ -15,9 +10,10 @@ COPY pnpm-lock.yaml ./
|
||||||
RUN pnpm fetch
|
RUN pnpm fetch
|
||||||
|
|
||||||
COPY . .
|
COPY . .
|
||||||
|
# Install production dependencies
|
||||||
RUN pnpm install --offline --prod --frozen-lockfile
|
RUN pnpm install --offline --prod --frozen-lockfile
|
||||||
|
|
||||||
# Install dev dependencies
|
# Install dev dependencies (needed for the build step)
|
||||||
RUN pnpm install --offline --frozen-lockfile
|
RUN pnpm install --offline --frozen-lockfile
|
||||||
|
|
||||||
# Build
|
# Build
|
||||||
|
@ -26,6 +22,3 @@ RUN pnpm build
|
||||||
|
|
||||||
ENTRYPOINT ["node", "build"]
|
ENTRYPOINT ["node", "build"]
|
||||||
EXPOSE 3000
|
EXPOSE 3000
|
||||||
```
|
|
||||||
|
|
||||||
You can safely clean with `docker builder prune --f` after that. It won't touch the cache.
|
|
Loading…
Reference in New Issue
Block a user