From 6179bd48f8684f01304334201b5d2a3de67cc4c6 Mon Sep 17 00:00:00 2001 From: SalkCoding Date: Mon, 9 Dec 2024 00:55:34 +0900 Subject: [PATCH] Test actions commit --- .github/workflows/CD.yml | 14 ++++++++++---- compose.yaml | 9 +++++++++ src/main/resources/application.yml | 6 +++--- 3 files changed, 22 insertions(+), 7 deletions(-) diff --git a/.github/workflows/CD.yml b/.github/workflows/CD.yml index 7619dc8..4b5ecd0 100644 --- a/.github/workflows/CD.yml +++ b/.github/workflows/CD.yml @@ -25,12 +25,18 @@ jobs: context: . push: true tags: ${{ secrets.DOCKER_USERNAME }}/backend:latest - - - name: Set envionment variables + build-args: + DB_HOST: ${{ secrets.DB_HOST }} + DB_PORT: ${{ secrets.DB_PORT }} + DB_NAME: ${{ secrets.DB_NAME }} + DB_USERNAME: ${{ secrets.DB_USERNAME }} + DB_PASSWORD: ${{ secrets.DB_PASSWORD }} + + - name: Set environment variables run: | - echo "MYSQL_DATABASE=${{ secrets.MYSQL_DATABASE }}" > .env - echo "MYSQL_ROOT_PASSWORD=${{ secrets.MYSQL_ROOT_PASSWORD }}" >> .env + echo "MYSQL_DATABASE=${{ secrets.DB_NAME }}" > .env + echo "MYSQL_ROOT_PASSWORD=${{ secrets.DB_PASSWORD }}" >> .env - name: Deploy Application uses: appleboy/ssh-action@v1.0.3 diff --git a/compose.yaml b/compose.yaml index b59a610..59b1103 100644 --- a/compose.yaml +++ b/compose.yaml @@ -1,4 +1,12 @@ services: + backend: + image: 'salk1104/backend:latest' + ports: + - '8080:8080' + depends_on: + - mysql + - redis + mysql: image: 'mysql:latest' environment: @@ -6,6 +14,7 @@ services: MYSQL_ROOT_PASSWORD: ${MYSQL_ROOT_PASSWORD} ports: - '3306:3306' + redis: image: 'redis:latest' ports: diff --git a/src/main/resources/application.yml b/src/main/resources/application.yml index bbe6052..dcaeede 100644 --- a/src/main/resources/application.yml +++ b/src/main/resources/application.yml @@ -3,9 +3,9 @@ spring: name: OhLottery datasource: - url: jdbc:mysql://localhost:3306/ohlottery - username: root - password: + url: jdbc:mysql://${DB_HOST}:${DB_PORT}/${DB_NAME} + username: ${DB_USERNAME} + password: ${DB_PASSWORD} driver-class-name: com.mysql.cj.jdbc.Driver jpa: