fix(nginx): bake nginx.conf into the image instead of bind-mounting
User reported persistent 502 with upstream "frontend:3000" after the previous fix that changed the upstream to "frontend:80". Symptom is a stale conf still being served by the nginx container - the host volume mount was keeping an old file in play (cached image, missing git pull, or the conf simply not being re-read). Make this class of bug impossible: ship the conf inside the nginx service's image. A fresh build now guarantees the conf in the container matches the conf in the repo. - nginx/Dockerfile added (FROM nginx:alpine + COPY nginx.conf) - docker-compose nginx service: image -> build ./nginx; remove the conf bind mount entirely. Deploy: git pull && docker compose build nginx frontend && docker compose up -d --force-recreate
This commit is contained in:
@@ -31,12 +31,10 @@ services:
|
|||||||
- mc-filter
|
- mc-filter
|
||||||
|
|
||||||
nginx:
|
nginx:
|
||||||
image: nginx:alpine
|
build: ./nginx
|
||||||
container_name: mc-filter-nginx
|
container_name: mc-filter-nginx
|
||||||
ports:
|
ports:
|
||||||
- "8080:80" # 대시보드 접근 포트 (외부 포트포워딩 금지 권장)
|
- "8080:80" # 대시보드 접근 포트 (외부 포트포워딩 금지 권장)
|
||||||
volumes:
|
|
||||||
- ./nginx/nginx.conf:/etc/nginx/nginx.conf:ro
|
|
||||||
depends_on:
|
depends_on:
|
||||||
- api
|
- api
|
||||||
- frontend
|
- frontend
|
||||||
|
|||||||
6
nginx/Dockerfile
Normal file
6
nginx/Dockerfile
Normal file
@@ -0,0 +1,6 @@
|
|||||||
|
# nginx.conf 를 image 에 굽는다.
|
||||||
|
# (volume mount 로 운영하다 보면 호스트 측 conf 가 stale 일 때 영문도 모르고
|
||||||
|
# 502 가 나는 경우가 있어 image 안에 직접 포함시킨다.)
|
||||||
|
FROM nginx:alpine
|
||||||
|
COPY nginx.conf /etc/nginx/nginx.conf
|
||||||
|
EXPOSE 80
|
||||||
Reference in New Issue
Block a user