Last active
October 6, 2024 12:03
-
-
Save LeopoldLabs/ba18f80cf77b0b31f1d8ef7e244f0252 to your computer and use it in GitHub Desktop.
Sveltekit Dockerfile
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
FROM node:20-alpine AS base | |
FROM base AS dependencies | |
RUN apk add --no-cache libc6-compat | |
WORKDIR /app | |
COPY package.json pnpm-lock.yaml ./ | |
RUN corepack enable pnpm | |
RUN pnpm i --frozen-lockfile | |
FROM base AS builder | |
WORKDIR /app | |
COPY --from=dependencies /app/node_modules ./node_modules | |
COPY . . | |
RUN npm run build | |
FROM base AS runner | |
WORKDIR /app | |
RUN addgroup --system --gid 1001 nodejs | |
RUN adduser --system --uid 1001 svelte | |
COPY --from=builder --chown=svelte:nodejs /app/static ./static | |
COPY --from=builder --chown=svelte:nodejs /app/build ./build | |
COPY --from=builder --chown=svelte:nodejs /app/package.json ./package.json | |
USER svelte | |
EXPOSE 3000 | |
ENV PORT=3000 | |
CMD ["node", "build"] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment