diff --git a/docker-compose.yml b/docker-compose.yml new file mode 100644 index 00000000..2ff6a53a --- /dev/null +++ b/docker-compose.yml @@ -0,0 +1,15 @@ +name: edpacca + +services: + dev: + build: + context: . + dockerfile: ./docker/dockerfile + ports: + - "5000:5000" + volumes: + - .:/app + - /app/node_modules + environment: + - NODE_ENV=production + - PORT=5000 diff --git a/docker/.dockerignore b/docker/.dockerignore new file mode 100644 index 00000000..dfe9310d --- /dev/null +++ b/docker/.dockerignore @@ -0,0 +1,35 @@ +# Ignore the Dockerfile itself +Dockerfile +Dockerfile.dev +Dockerfile.prod + +# Ignore Docker configuration files +.dockerignore + +# Ignore Git files +.git +.gitignore +.gitattributes + +# Ignore Node modules +node_modules + +# Ignore build artifacts +build + +# Ignore environment files +**/.env + +# Ignore editor configuration files +.editorconfig +.vscode + +# Ignore SvelteKit specific files +.svelte-kit + +# Ignore other configuration files +README.md +.npmrc +.prettierrc +.eslintrc.cjs +.graphqlrc diff --git a/docker/dockerfile b/docker/dockerfile new file mode 100644 index 00000000..27419bd8 --- /dev/null +++ b/docker/dockerfile @@ -0,0 +1,28 @@ +FROM node:22-slim AS builder + +WORKDIR /app + +COPY package.json package-lock.json ./ + +COPY svelte.config.js ./ + +RUN npm ci + +COPY . . +RUN npm run build + +RUN npm prune --omit=dev + +FROM node:22-slim AS runner + +WORKDIR /app + +COPY --from=builder /app/build build/ +COPY --from=builder /app/node_modules node_modules/ +COPY package.json . + +EXPOSE 5000 + +ENV NODE_ENV=production + +CMD ["node", "build"]