From 1fe5c4dfd36d5af06dd7c23a0c9d1f83c500e358 Mon Sep 17 00:00:00 2001 From: schreifuchs Date: Tue, 20 Jan 2026 22:47:34 +0100 Subject: [PATCH] feat: dickerization --- .dockerignore | 13 ++++++++++++ Dockerfile | 46 +++++++++++++++++++++++++++++++++++++++++++ src/routes/+layout.ts | 5 ++--- 3 files changed, 61 insertions(+), 3 deletions(-) create mode 100644 .dockerignore create mode 100644 Dockerfile diff --git a/.dockerignore b/.dockerignore new file mode 100644 index 0000000..3438ef9 --- /dev/null +++ b/.dockerignore @@ -0,0 +1,13 @@ +node_modules +build +.svelte-kit +.git +.env +.env.* +!.env.example +docker-compose.yml +Dockerfile +README.md +TODO_NEXTCLOUD.md +GEMINI.md +pnpm-workspace.yaml diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..01cb891 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,46 @@ +# Stage 1: Build the application +FROM node:24-slim AS builder + +# Enable corepack to use pnpm +RUN corepack enable + +WORKDIR /app + +# Copy configuration files +COPY package.json pnpm-lock.yaml .npmrc ./ + +# Install all dependencies (including devDependencies) +RUN pnpm install --frozen-lockfile + +# Copy the rest of the application code +COPY . . + +# Build the SvelteKit application +RUN pnpm run build + +# Stage 2: Run the application +FROM node:24-slim AS runner + +# Enable corepack to use pnpm +RUN corepack enable + +WORKDIR /app + +# Copy the build output and necessary files for production +COPY --from=builder /app/build ./build +COPY --from=builder /app/package.json ./package.json +COPY --from=builder /app/pnpm-lock.yaml ./pnpm-lock.yaml +COPY --from=builder /app/.npmrc ./.npmrc + +# Install only production dependencies +RUN pnpm install --prod --frozen-lockfile + +# Expose the port the app runs on (SvelteKit defaults to 3000) +EXPOSE 3000 + +# Set environment variables +ENV NODE_ENV=production +ENV PORT=3000 + +# Run the application +CMD ["node", "build"] diff --git a/src/routes/+layout.ts b/src/routes/+layout.ts index 47ca713..9406451 100644 --- a/src/routes/+layout.ts +++ b/src/routes/+layout.ts @@ -1,4 +1,3 @@ // This can be false if you're using a fallback (i.e. SPA mode) -export const prerender = true; -export const trailingSlash = 'always'; - +// export const prerender = true; +// export const trailingSlash = 'always';