Skip to content

Commit dc7b081

Browse files
RookieANDclaude
andauthored
build: Docker 빌드 시 NEXT_PUBLIC 환경변수 주입 프로세스 추가 (#47)
* setting: Dockerfile 에 대해 ENV ARG 를 받도록 수정 * refactor: .env.production 파일 기반 환경변수 주입으로 전환 Dockerfile의 ARG/ENV 반복 선언을 제거하고, GitHub Actions에서 .env.production 파일을 생성하여 빌드 컨텍스트에 포함하는 방식으로 변경. 환경변수 추가 시 workflow 파일만 수정하면 된다. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com>
1 parent f7bf794 commit dc7b081

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

.github/workflows/production-deploy.yml

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,12 +40,20 @@ jobs:
4040
if: steps.changes.outputs.client == 'true' || steps.changes.outputs.nginx == 'true'
4141
uses: docker/setup-buildx-action@v3
4242

43+
- name: Create .env.production
44+
if: steps.changes.outputs.client == 'true'
45+
run: |
46+
cat <<EOF > .env.production
47+
NEXT_PUBLIC_API_URL=${{ secrets.NEXT_PUBLIC_API_URL }}
48+
NEXT_PUBLIC_AWS_S3=${{ secrets.NEXT_PUBLIC_AWS_S3 }}
49+
EOF
50+
4351
- name: Build and Push Client image
4452
if: steps.changes.outputs.client == 'true'
4553
uses: docker/build-push-action@v5
4654
with:
4755
push: true
48-
# platforms: linux/amd64,linux/arm64/v8
56+
context: .
4957
file: ./docker/client/Dockerfile
5058
tags: ${{ secrets.DOCKER_HUB_USERNAME }}/yogieat-client:latest
5159
cache-from: type=gha

0 commit comments

Comments
 (0)