From 8bc880fe1092658af37f310fc77eb38e1b043c82 Mon Sep 17 00:00:00 2001 From: "Hunter W." Date: Fri, 27 Mar 2026 01:31:21 -0400 Subject: [PATCH] added docker compose --- Dockerfile | 34 ++++++++++++++++++++++++++++++++++ docker-compose.yml | 17 +++++++++++++++++ dockerignore | 8 ++++++++ next.config.ts | 1 + 4 files changed, 60 insertions(+) create mode 100644 Dockerfile create mode 100644 docker-compose.yml create mode 100644 dockerignore diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..690780d --- /dev/null +++ b/Dockerfile @@ -0,0 +1,34 @@ +# ---- Dependencies ---- +FROM node:20-alpine AS deps +WORKDIR /app +COPY package.json package-lock.json* ./ +RUN npm ci --omit=dev + +# ---- Build ---- +FROM node:20-alpine AS build +WORKDIR /app +COPY package.json package-lock.json* ./ +RUN npm ci +COPY . . +RUN npm run build + +# ---- Production ---- +FROM node:20-alpine AS runner +WORKDIR /app + +ENV NODE_ENV=production +ENV NEXT_TELEMETRY_DISABLED=1 +ENV HOSTNAME=0.0.0.0 +ENV PORT=3050 + +RUN addgroup --system --gid 1001 app && \ + adduser --system --uid 1001 app + +COPY --from=build /app/public ./public +COPY --from=build --chown=app:app /app/.next/standalone ./ +COPY --from=build --chown=app:app /app/.next/static ./.next/static + +USER app +EXPOSE 3050 + +CMD ["node", "server.js"] diff --git a/docker-compose.yml b/docker-compose.yml new file mode 100644 index 0000000..ae55387 --- /dev/null +++ b/docker-compose.yml @@ -0,0 +1,17 @@ +services: + portfolio: + build: + context: . + dockerfile: Dockerfile + ports: + - "3050:3050" + environment: + - NODE_ENV=production + - NEXT_TELEMETRY_DISABLED=1 + restart: unless-stopped + healthcheck: + test: ["CMD", "wget", "--spider", "-q", "http://localhost:3050"] + interval: 30s + timeout: 5s + retries: 3 + start_period: 10s diff --git a/dockerignore b/dockerignore new file mode 100644 index 0000000..d37f8c5 --- /dev/null +++ b/dockerignore @@ -0,0 +1,8 @@ +node_modules +.next +.git +.gitignore +*.md +.env*.local +.vscode +.idea diff --git a/next.config.ts b/next.config.ts index 0b1ec0b..e721b1a 100644 --- a/next.config.ts +++ b/next.config.ts @@ -2,6 +2,7 @@ import type { NextConfig } from "next"; const nextConfig: NextConfig = { reactCompiler: true, + output: "standalone" }; export default nextConfig;