diff --git a/.dockerignore b/.dockerignore new file mode 100644 index 0000000..f74c781 --- /dev/null +++ b/.dockerignore @@ -0,0 +1,2 @@ +.next +node_modules diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..ec946b1 --- /dev/null +++ b/Dockerfile @@ -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"] diff --git a/docker-compose.yml b/docker-compose.yml new file mode 100644 index 0000000..79a41b4 --- /dev/null +++ b/docker-compose.yml @@ -0,0 +1,7 @@ +services: + app: + build: + context: . + dockerfile: Dockerfile + ports: + - "3000:3000" diff --git a/next.config.ts b/next.config.ts index e9ffa30..68a6c64 100644 --- a/next.config.ts +++ b/next.config.ts @@ -1,7 +1,7 @@ import type { NextConfig } from "next"; const nextConfig: NextConfig = { - /* config options here */ + output: "standalone", }; export default nextConfig; diff --git a/public/.gitkeep b/public/.gitkeep new file mode 100644 index 0000000..e69de29