Skip to content

Instantly share code, notes, and snippets.

@khromov
Last active January 11, 2023 20:04
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save khromov/390e03a5765659a8313127568c10c463 to your computer and use it in GitHub Desktop.
Save khromov/390e03a5765659a8313127568c10c463 to your computer and use it in GitHub Desktop.
SvelteKit staged build Dockerfile
node_modules
README.md
.svelte-kit
npm-debug.log*
yarn-debug.log*
yarn-error.log*
.pnpm-debug.log*
.env*.local
.env.local
.env
FROM node:18-alpine AS sk-build
ARG TZ=Europe/Stockholm
WORKDIR /usr/src/app
COPY . /usr/src/app
RUN apk --no-cache add curl tzdata
RUN cp /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone
RUN npm install
RUN npm run build
FROM node:18-alpine
WORKDIR /usr/src/app
COPY --from=sk-build /usr/src/app/build /usr/src/app/build
COPY --from=sk-build /usr/src/app/package.json /usr/src/app/package.json
EXPOSE 3000
# Your start command in package.json should look something like: node build/index.js
CMD ["npm", "run", "start"]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment