Created
April 9, 2023 09:42
-
-
Save Maxiviper117/6410962a4e0b16538b7fb6ecd567afbc to your computer and use it in GitHub Desktop.
Example `dockerfile` for a Sveltekit Project
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
# ---- Base Node ---- | |
FROM node:19-alpine AS base | |
WORKDIR /app | |
COPY package*.json ./ | |
# ---- Dependencies ---- | |
FROM base AS dependencies | |
RUN npm ci | |
# ---- Build ---- | |
FROM dependencies AS build | |
COPY . . | |
RUN npm run build | |
# ---- Production ---- | |
FROM node:19-alpine AS production | |
WORKDIR /app | |
COPY --from=dependencies /app/node_modules ./node_modules | |
COPY --from=build /app/build ./build | |
COPY --from=build /app/package*.json ./ | |
# Expose the port the app will run on | |
EXPOSE 3000 | |
# Start the application | |
# added "start": "node ./build", to package.json "scripts" section | |
CMD ["npm", "start"] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Ensure to install this dependency:
npm install @sveltejs/adapter-node --save-dev
Modify
svelte.config.js