Skip to content

Instantly share code, notes, and snippets.

@begoon
Last active July 8, 2023 14:40
Show Gist options
  • Save begoon/4afa081eaddf0672dd98ea0321e28338 to your computer and use it in GitHub Desktop.
Save begoon/4afa081eaddf0672dd98ea0321e28338 to your computer and use it in GitHub Desktop.
Dockerize SvelteKit app for nodejs
FROM node:20.2.0-bullseye-slim AS build
WORKDIR /app
COPY . .
RUN npm install
RUN npm run build
# ---
FROM node:20.2.0-bullseye-slim AS package
WORKDIR /app
COPY package.json .
COPY package-lock.json .
RUN npm ci --production
# ---
FROM node:20.2.0-bullseye-slim
WORKDIR /app
COPY --from=build /app/build build/
COPY --from=package /app/node_modules node_modules/
COPY package.json .
CMD [ "node", "build" ]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment