Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ci/179 : 도커 빌드시, 스프링 프로파일 전달 #182

Merged
merged 1 commit into from
Jul 28, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion .github/workflows/dev-deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,10 @@ jobs:
name: build-artifact
path: build/libs/*.jar

deploy:
runs-on: ubuntu-latest
needs: build-and-deploy
steps:
- name: Download build artifacts
uses: actions/download-artifact@v3
with:
Expand All @@ -73,7 +77,7 @@ jobs:

- name: Build Docker image
run: |
docker build -t ${{ secrets.DEV_AWS_ECR_REPOSITORY_URL }}:${{ github.sha }} .
docker build --build-arg SPRING_PROFILES_ACTIVE=dev -t ${{ secrets.DEV_AWS_ECR_REPOSITORY_URL }}:${{ github.sha }} .

- name: Push Docker image to ECR
run: |
Expand Down
6 changes: 5 additions & 1 deletion .github/workflows/prod-deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,10 @@ jobs:
name: build-artifact
path: build/libs/*.jar

deploy:
runs-on: ubuntu-latest
needs: build-and-deploy
steps:
- name: Download build artifacts
uses: actions/download-artifact@v3
with:
Expand All @@ -73,7 +77,7 @@ jobs:

- name: Build Docker image
run: |
docker build -t ${{ secrets.AWS_ECR_REPOSITORY_URL }}:${{ github.sha }} .
docker build --build-arg SPRING_PROFILES_ACTIVE=prod -t ${{ secrets.AWS_ECR_REPOSITORY_URL }}:${{ github.sha }} .

- name: Push Docker image to ECR
run: |
Expand Down
12 changes: 7 additions & 5 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
# 런타임 이미지 준비
FROM openjdk:17-jdk-slim

# 타임존 설정을 위해 tzdata 패키지 설치
Expand All @@ -8,8 +7,11 @@ RUN apt-get update && apt-get install -y tzdata
ENV TZ=Asia/Seoul
RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone

# 빌드된 JAR 파일 복사
COPY build/libs/*.jar app.jar
# 애플리케이션 JAR 파일 추가
ADD app.jar app.jar

# 애플리케이션 실행
ENTRYPOINT ["java","-jar","/app.jar"]
# 프로파일 ARG 설정
ARG SPRING_PROFILES_ACTIVE
ENV SPRING_PROFILES_ACTIVE=${SPRING_PROFILES_ACTIVE}

ENTRYPOINT ["java", "-Djava.security.egd=file:/dev/./urandom", "-jar", "/app.jar"]
Loading