From 8dcf64c098199affeeed30d3abd1f57dfb26a477 Mon Sep 17 00:00:00 2001 From: JirA44 Date: Thu, 28 May 2026 11:22:23 +0200 Subject: [PATCH] feat: add Docker support Adds a multi-stage Dockerfile, .dockerignore, and docker-compose.yml so the app can be spun up with a single command: docker compose up --build Uses Node 20 Alpine with libc6-compat for sharp native bindings. Three stages (deps / builder / runner) keep the final image lean. Closes #32 --- .dockerignore | 10 ++++++++++ Dockerfile | 35 +++++++++++++++++++++++++++++++++++ docker-compose.yml | 6 ++++++ 3 files changed, 51 insertions(+) create mode 100644 .dockerignore create mode 100644 Dockerfile create mode 100644 docker-compose.yml diff --git a/.dockerignore b/.dockerignore new file mode 100644 index 0000000..f58f3de --- /dev/null +++ b/.dockerignore @@ -0,0 +1,10 @@ +.git +.gitignore +node_modules +.next +.env* +!.env.example +README.md +Dockerfile +.dockerignore +docker-compose.yml diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..e2f2d8c --- /dev/null +++ b/Dockerfile @@ -0,0 +1,35 @@ +FROM node:20-alpine AS base +RUN apk add --no-cache libc6-compat + +FROM base AS deps +WORKDIR /app +COPY package.json yarn.lock* ./ +RUN npm install --legacy-peer-deps + +FROM base AS builder +WORKDIR /app +COPY --from=deps /app/node_modules ./node_modules +COPY . . +ENV NEXT_TELEMETRY_DISABLED=1 +RUN npm run build + +FROM base AS runner +WORKDIR /app +ENV NODE_ENV=production +ENV NEXT_TELEMETRY_DISABLED=1 + +RUN addgroup --system --gid 1001 nodejs +RUN adduser --system --uid 1001 nextjs + +COPY --from=builder /app/public ./public +COPY --from=builder --chown=nextjs:nodejs /app/.next ./.next +COPY --from=builder /app/node_modules ./node_modules +COPY --from=builder /app/package.json ./package.json +COPY --from=builder /app/next.config.mjs ./next.config.mjs + +USER nextjs +EXPOSE 3000 +ENV PORT=3000 +ENV HOSTNAME=0.0.0.0 + +CMD ["node_modules/.bin/next", "start"] diff --git a/docker-compose.yml b/docker-compose.yml new file mode 100644 index 0000000..cb10e90 --- /dev/null +++ b/docker-compose.yml @@ -0,0 +1,6 @@ +services: + removerized: + build: . + ports: + - "3000:3000" + restart: unless-stopped