chore: Support building with Docker

This commit is contained in:
Dominik 2025-04-16 21:48:50 +02:00
parent de3b35bfa9
commit 6e60dfa44b
Signed by: dominik
GPG key ID: 06A4003FC5049644
5 changed files with 43 additions and 1 deletions

2
.dockerignore Normal file
View file

@ -0,0 +1,2 @@
.next
node_modules

33
Dockerfile Normal file
View file

@ -0,0 +1,33 @@
FROM node:22-alpine AS base
# ----- Dependencies -----
FROM base AS deps
WORKDIR /app
COPY package.json yarn.lock ./
RUN yarn install --frozen-lockfile
# ----- Build -----
FROM base AS builder
WORKDIR /app
COPY --from=deps /app/node_modules ./node_modules
COPY . .
RUN yarn build
# ----- Runner -----
FROM gcr.io/distroless/nodejs22-debian12:nonroot AS runner
WORKDIR /app
ENV NODE_ENV=production
ENV NEXT_TELEMETRY_DISABLED=1
COPY --from=builder /app/public ./public
COPY --from=builder /app/.next/standalone ./
COPY --from=builder /app/.next/static ./.next/static
EXPOSE 3000
ENV HOSTNAME="0.0.0.0"
CMD ["server.js"]

7
docker-compose.yml Normal file
View file

@ -0,0 +1,7 @@
services:
app:
build:
context: .
dockerfile: Dockerfile
ports:
- "3000:3000"

View file

@ -1,7 +1,7 @@
import type { NextConfig } from "next";
const nextConfig: NextConfig = {
/* config options here */
output: "standalone",
};
export default nextConfig;

0
public/.gitkeep Normal file
View file