-
Notifications
You must be signed in to change notification settings - Fork 0
91 lines (81 loc) · 3.14 KB
/
backend_dev_test.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
name: JUMO server-dev CD
on:
push:
branches:
- 'feature/BYOB-129'
jobs:
build-docker-image:
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
steps:
- uses: actions/checkout@v4
# JDK 설치
- name: Set up JDK 17
uses: actions/setup-java@v4
with:
java-version: '17'
distribution: 'temurin'
# AWS Secrets Manager, AWS ECR 사용을 위해 AWS 자격 증명을 수행하는 단계
- name: Configure AWS credentials
uses: aws-actions/configure-aws-credentials@v1
with:
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
aws-region: ${{ secrets.AWS_REGION }}
# AWS Secrets Manager에서 관리하는 보안 암호를 환경변수로 가져오는 단계
- name: AWS Secrets Manager에서 환경변수 가져오기
uses: aws-actions/aws-secretsmanager-get-secrets@v2
with:
secret-ids: |
,dev/jumo/server
# comma 오타 아님
parse-json-secrets: true
# 디버깅용 스텝
- name: Print environment variables
run: |
echo $DEV_JUMO_SERVER
export
# - name: Setup Gradle
# uses: gradle/actions/setup-gradle@417ae3ccd767c252f5661f1ace9f835f9654f2b5 # v3.1.0
#
# - name: Grant execute permission for gradlew
# run: chmod +x gradlew
#
# - name: Build with Gradle Wrapper
# run: ./gradlew build
# - name: Login to Amazon ECR
# uses: aws-actions/amazon-ecr-login@v1
#
# - name: Build and push Docker image to AWS ECR
# run: |
# docker build -t ${{ secrets.AWS_ACCOUNT_ID }}.dkr.ecr.${{ secrets.AWS_REGION }}.amazonaws.com/jumo_back_dev:latest .
# docker push ${{ secrets.AWS_ACCOUNT_ID }}.dkr.ecr.${{ secrets.AWS_REGION }}.amazonaws.com/jumo_back_dev:latest
# deploy:
# needs: build-docker-image
# runs-on: [dev]
# steps:
# - name: Clean up Docker system before pulling
# run: |
# sudo docker stop $(sudo docker ps -aq) || true
# sudo docker container prune -f || true
# sudo docker image prune -a -f || true
# sudo docker volume prune -f || true
# sudo docker network prune -f || true
# sudo docker system prune -a -f || true
#
# - name: ecr get-login-password
# run: |
# aws ecr get-login-password --region ${{ secrets.AWS_REGION }} | docker login --username AWS --password-stdin ${{ secrets.AWS_ACCOUNT_ID }}.dkr.ecr.${{ secrets.AWS_REGION }}.amazonaws.com/jumo_back_dev
# - name: Pull Docker image from AWS ECR
# run: |
# docker pull ${{ secrets.AWS_ACCOUNT_ID }}.dkr.ecr.${{ secrets.AWS_REGION }}.amazonaws.com/jumo_back_dev:latest
#
# - name: Run new Docker container
# run: |
# docker run --rm -it -d -p 80:8080 --name jumo_back_dev ${{ secrets.AWS_ACCOUNT_ID }}.dkr.ecr.${{ secrets.AWS_REGION }}.amazonaws.com/jumo_back_dev:latest
#
# - name: Clean up unused Docker images after deployment
# run: |
# sudo docker image prune -a -f || true