added docker compose

This commit is contained in:
Hunter W.
2026-03-27 01:31:21 -04:00
parent 960f74a754
commit 8bc880fe10
4 changed files with 60 additions and 0 deletions

34
Dockerfile Normal file
View File

@@ -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"]

17
docker-compose.yml Normal file
View File

@@ -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

8
dockerignore Normal file
View File

@@ -0,0 +1,8 @@
node_modules
.next
.git
.gitignore
*.md
.env*.local
.vscode
.idea

View File

@@ -2,6 +2,7 @@ import type { NextConfig } from "next";
const nextConfig: NextConfig = { const nextConfig: NextConfig = {
reactCompiler: true, reactCompiler: true,
output: "standalone"
}; };
export default nextConfig; export default nextConfig;