Skip to content

Commit a2e1b5b

Browse files
committed
fix: repair deploy image build
1 parent 55a56de commit a2e1b5b

5 files changed

Lines changed: 20 additions & 15 deletions

File tree

.github/workflows/deploy.yml

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -118,11 +118,12 @@ jobs:
118118
username: ${{ secrets.N100_USER }}
119119
key: ${{ secrets.N100_SSH_KEY }}
120120
# 호스트의 deploy/ 디렉터리에서 pull → up.
121-
# IMAGE_TAG 가 .env 의 placeholder 를 덮어쓰며 docker compose 가 사용.
121+
# IMAGE_TAG selects the pushed GHCR image; MURUN_ENV_FILE selects .env.staging/.env.prod.
122122
script: |
123123
set -e
124124
cd ${MURUN_DEPLOY_DIR:-~/murun-peterabcd/deploy}
125125
export IMAGE_TAG="${{ needs.build.outputs.image_tag }}"
126-
docker compose -p murun-${{ needs.build.outputs.target }} pull
127-
docker compose -p murun-${{ needs.build.outputs.target }} up -d --remove-orphans
126+
export MURUN_ENV_FILE=".env.${{ needs.build.outputs.target }}"
127+
docker compose -p murun-${{ needs.build.outputs.target }} --env-file "$MURUN_ENV_FILE" pull
128+
docker compose -p murun-${{ needs.build.outputs.target }} --env-file "$MURUN_ENV_FILE" up -d --remove-orphans
128129
docker image prune -f

deploy/Dockerfile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ RUN apk add --no-cache openssl libc6-compat
2020
RUN corepack enable
2121
COPY --from=deps /app/node_modules ./node_modules
2222
COPY . .
23+
RUN mkdir -p public
2324
ENV NEXT_TELEMETRY_DISABLED=1
2425
ENV NEXT_OUTPUT_STANDALONE=true
2526

deploy/README.md

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,9 @@ cp .env.example .env.prod
2323
echo "<PAT_with_read:packages>" | docker login ghcr.io -u <github_user> --password-stdin
2424

2525
# 4) 첫 가동 (이미지 빌드는 GH Actions 가 대신, 여기선 pull 만)
26+
export MURUN_ENV_FILE=.env.staging
27+
export IMAGE_TAG=staging
28+
2629
docker compose -p murun-staging --env-file .env.staging pull
2730
docker compose -p murun-staging --env-file .env.staging up -d
2831
```
@@ -60,9 +63,9 @@ cd murun-peterabcd/deploy
6063
cp .env.example .env
6164
# (도메인 붙기 전엔 DOMAIN=:80 그대로 두기)
6265

63-
# app 환경변수 (지금은 비어 있어도 OK, 후속 PR에서 채워짐)
64-
touch .env # app 서비스 env_file 이 ./.env 라서 같은 파일이 두 용도 겸함
65-
# — 추후 app.env 로 분리 예정
66+
# compose 변수와 app 환경변수를 같은 파일에서 읽음
67+
# 기본 수동 실행은 .env, staging/prod 분리는 MURUN_ENV_FILE 로 지정
68+
6669

6770
# 빌드 + 기동
6871
docker compose up -d --build
@@ -77,7 +80,7 @@ curl -fsS http://localhost/ && echo OK
7780
cd murun-peterabcd
7881
git pull
7982
cd deploy
80-
docker compose up -d --build
83+
MURUN_ENV_FILE=.env docker compose --env-file .env up -d --build
8184
docker image prune -f
8285
```
8386

@@ -86,11 +89,11 @@ docker image prune -f
8689
같은 디렉터리에 `.env.staging`, `.env.prod` 를 별도로 두고 project name 으로 분리.
8790

8891
```bash
89-
# staging (포트 8080)
90-
CADDY_HTTP_PORT=8080 docker compose -p murun-staging --env-file .env.staging up -d --build
92+
# staging (포트 8080; .env.staging 안에 CADDY_HTTP_PORT=8080 권장)
93+
MURUN_ENV_FILE=.env.staging docker compose -p murun-staging --env-file .env.staging up -d --build
9194

9295
# prod (포트 80)
93-
docker compose -p murun-prod --env-file .env.prod up -d --build
96+
MURUN_ENV_FILE=.env.prod docker compose -p murun-prod --env-file .env.prod up -d --build
9497
```
9598

9699
볼륨은 project name prefix 가 자동으로 붙어 분리됨 (`murun-staging_data` vs `murun-prod_data`).
@@ -109,10 +112,10 @@ docker compose -p murun-prod --env-file .env.prod up -d --build
109112

110113
```bash
111114
# 직전 이미지 태그 확인
112-
docker images ghcr.io/boostcampwm-snu-2026-1/murun --format '{{.Tag}}\t{{.CreatedAt}}'
115+
docker images ghcr.io/boostcampwm-snu-2026-1/murun-peterabcd --format '{{.Tag}}\t{{.CreatedAt}}'
113116

114117
# 특정 태그로 되돌리기
115-
IMAGE_TAG=<sha> docker compose up -d
118+
IMAGE_TAG=<tag> MURUN_ENV_FILE=.env.staging docker compose --env-file .env.staging up -d
116119
```
117120

118121
## 6. 트러블슈팅

deploy/docker-compose.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,10 +17,10 @@ services:
1717
build:
1818
context: ..
1919
dockerfile: deploy/Dockerfile
20-
image: ghcr.io/boostcampwm-snu-2026-1/murun:${IMAGE_TAG:-local}
20+
image: ghcr.io/boostcampwm-snu-2026-1/murun-peterabcd:${IMAGE_TAG:-local}
2121
restart: unless-stopped
2222
env_file:
23-
- ./.env
23+
- ${MURUN_ENV_FILE:-.env}
2424
volumes:
2525
- data:/app/data
2626
- uploads:/app/uploads

docs/wiki/02-Tech-Stack.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -154,7 +154,7 @@ murun-peterabcd/
154154
```
155155

156156
- staging/prod 분리: 같은 이미지를 `-p murun-staging` / `-p murun-prod` 다른 project name으로 동시에. 볼륨·포트·서브도메인 전부 분리.
157-
- 빌드는 GitHub Actions에서 → `ghcr.io/boostcampwm-snu-2026-1/murun:<sha>` 로 push. N100은 pull만.
157+
- 빌드는 GitHub Actions에서 → `ghcr.io/boostcampwm-snu-2026-1/murun-peterabcd:<target-sha>` 로 push. N100은 pull만.
158158

159159
## 6. 채택하지 않은 것
160160

0 commit comments

Comments
 (0)