feat: Add docker deployment

This commit is contained in:
Björn Benouarets
2025-11-04 22:23:29 +01:00
parent ca581a382f
commit aef92df592
4 changed files with 100 additions and 1 deletions

57
.dockerignore Normal file
View File

@@ -0,0 +1,57 @@
# Dependencies
node_modules
.pnp
.pnp.js
# Testing
coverage
# Next.js
.next
out
# Production
build
dist
# Misc
.DS_Store
*.pem
# Debug
npm-debug.log*
yarn-debug.log*
yarn-error.log*
pnpm-debug.log*
# Local env files
.env*.local
.env
# Vercel
.vercel
# TypeScript
*.tsbuildinfo
next-env.d.ts
# Git
.git
.gitignore
# Docker
Dockerfile
docker-compose.yml
.dockerignore
# IDE
.vscode
.idea
*.swp
*.swo
*~
# Documentation
README.md
*.md

16
Dockerfile Normal file
View File

@@ -0,0 +1,16 @@
FROM node:22-alpine AS builder
WORKDIR /app
COPY package*.json ./
RUN npm ci
COPY . .
RUN npm run build
FROM node:22-alpine AS runner
WORKDIR /app
COPY --from=builder /app ./
EXPOSE 3000
CMD ["npm", "start"]

26
docker-compose.yml Normal file
View File

@@ -0,0 +1,26 @@
version: '3.8'
services:
miniquiz-ui:
build:
context: .
dockerfile: Dockerfile
container_name: miniquiz-ui
ports:
- "3000:3000"
environment:
- NODE_ENV=production
- NEXT_TELEMETRY_DISABLED=1
- NEXT_PUBLIC_MINIQUIZ_TITLE=${NEXT_PUBLIC_MINIQUIZ_TITLE}
- NEXT_PUBLIC_MINIQUIZ_QUESTION=${NEXT_PUBLIC_MINIQUIZ_QUESTION}
- NEXT_PUBLIC_MINIQUIZ_OPTIONS=${NEXT_PUBLIC_MINIQUIZ_OPTIONS}
- NEXT_PUBLIC_MINIQUIZ_ANSWER=${NEXT_PUBLIC_MINIQUIZ_ANSWER}
- NEXT_PUBLIC_MINIQUIZ_NEXTURL=${NEXT_PUBLIC_MINIQUIZ_NEXTURL}
restart: unless-stopped
healthcheck:
test: ["CMD", "wget", "--no-verbose", "--tries=1", "--spider", "http://localhost:3000"]
interval: 30s
timeout: 10s
retries: 3
start_period: 40s

View File

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