File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ FROM node:22-alpine AS deps
2+ WORKDIR /app
3+
4+ COPY package.json package-lock.json .npmrc ./
5+ RUN npm ci
6+
7+ FROM node:22-alpine AS builder
8+ WORKDIR /app
9+
10+ COPY --from=deps /app/node_modules ./node_modules
11+ COPY . .
12+
13+ ENV NEXT_TELEMETRY_DISABLED=1
14+ RUN npm run build
15+ RUN npm prune --omit=dev
16+
17+ FROM node:22-alpine AS runner
18+ WORKDIR /app
19+
20+ ENV NODE_ENV=production
21+ ENV NEXT_TELEMETRY_DISABLED=1
22+ ENV PORT=3000
23+ ENV HOSTNAME=0.0.0.0
24+
25+ COPY --from=builder /app/public ./public
26+ COPY --from=builder /app/.next ./.next
27+ COPY --from=builder /app/node_modules ./node_modules
28+ COPY --from=builder /app/package.json ./package.json
29+ COPY --from=builder /app/next.config.ts ./next.config.ts
30+
31+ EXPOSE 3000
32+ CMD ["npm" , "run" , "start" ]
Original file line number Diff line number Diff line change 1+ version : " 3.8"
2+
3+ services :
4+ web :
5+ image : ghcr.io/team-senifit/web:${IMAGE_TAG:-latest}
6+ environment :
7+ NODE_ENV : production
8+ NEXT_PUBLIC_API_URL : ${NEXT_PUBLIC_API_URL:-https://api.senifit.co.kr:8443}
9+ volumes :
10+ - ./logs/nextjs:/app/logs/nextjs
11+ expose :
12+ - " 3000"
13+ command : >
14+ sh -c "mkdir -p /app/logs/nextjs &&
15+ npm run start >> /app/logs/nextjs/app.log 2>&1"
16+ restart : unless-stopped
17+
18+ nginx :
19+ image : nginx:1.27-alpine
20+ depends_on :
21+ - web
22+ ports :
23+ - " 80:80"
24+ - " 443:443"
25+ volumes :
26+ - ./nginx/nginx.conf:/etc/nginx/nginx.conf:ro
27+ - ./nginx/conf.d:/etc/nginx/conf.d:ro
28+ - ./nginx/certs:/etc/nginx/certs:ro
29+ - ./logs/nginx:/var/log/nginx
30+ restart : unless-stopped
Original file line number Diff line number Diff line change 1+ server {
2+ listen 80;
3+ server_name _;
4+ return 301 https://$host$request_uri;
5+ }
6+
7+ server {
8+ listen 443 ssl http2;
9+ server_name _;
10+
11+ ssl_certificate /etc/nginx/certs/fullchain.pem;
12+ ssl_certificate_key /etc/nginx/certs/private-key.pem;
13+ ssl_protocols TLSv1.2 TLSv1.3;
14+ ssl_prefer_server_ciphers on;
15+
16+ location / {
17+ proxy_pass http://web:3000;
18+ proxy_http_version 1.1;
19+ proxy_set_header Host $host;
20+ proxy_set_header X-Real-IP $remote_addr;
21+ proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
22+ proxy_set_header X-Forwarded-Proto https;
23+ proxy_set_header Upgrade $http_upgrade;
24+ proxy_set_header Connection $connection_upgrade;
25+ }
26+ }
Original file line number Diff line number Diff line change 1+ user nginx;
2+ worker_processes auto;
3+
4+ error_log /var/log/nginx/app.log warn;
5+ pid /var/run/nginx.pid ;
6+
7+ events {
8+ worker_connections 1024 ;
9+ }
10+
11+ http {
12+ include /etc/nginx/mime.types ;
13+ default_type application/octet-stream ;
14+
15+ log_format main '$remote_addr - $remote_user [$time_local] "$request" '
16+ '$status $body_bytes_sent "$http_referer" '
17+ '"$http_user_agent" "$http_x_forwarded_for"' ;
18+
19+ access_log /var/log/nginx/app.log main;
20+
21+ sendfile on;
22+ keepalive_timeout 65 ;
23+
24+ map $http_upgrade $connection_upgrade {
25+ default upgrade;
26+ "" close;
27+ }
28+
29+ include /etc/nginx/conf.d/*.conf;
30+ }
You can’t perform that action at this time.
0 commit comments