From ba82fcc296e6fb225993348bfbbf164fff850e99 Mon Sep 17 00:00:00 2001 From: nahowo Date: Thu, 5 Dec 2024 18:29:11 +0900 Subject: [PATCH] =?UTF-8?q?cicd=20=ED=99=98=EA=B2=BD=EB=B3=80=EC=88=98=20?= =?UTF-8?q?=EC=B0=B8=EC=A1=B0=20=EB=B3=80=EA=B2=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/cicd.yml | 32 ++++++++++++-------------------- docker-compose.yml | 2 ++ 2 files changed, 14 insertions(+), 20 deletions(-) diff --git a/.github/workflows/cicd.yml b/.github/workflows/cicd.yml index 0979782..a5b7a26 100644 --- a/.github/workflows/cicd.yml +++ b/.github/workflows/cicd.yml @@ -31,8 +31,8 @@ jobs: # 환경 변수 설정 - name: Set environment values run: | - touch ./src/main/resources/env.properties - echo "${{ secrets.ENV_PROPERTIES }}" > ./src/main/resources/env.properties + touch ./.env + echo "${{ secrets.ENV }}" > ./.env shell: bash # Gradle build @@ -68,21 +68,13 @@ jobs: MYSQL_PASSWORD=${{ secrets.MYSQL_PASSWORD }} script: | sudo echo ${{ secrets.DOCKERHUB_PASSWORD }} | docker login -u ${{ secrets.DOCKERHUB_USERNAME }} --password-stdin - sudo SPRING_DATASOURCE_URL=$SPRING_DATASOURCE_URL \ - SPRING_DATASOURCE_USERNAME=$SPRING_DATASOURCE_USERNAME \ - SPRING_DATASOURCE_PASSWORD=$SPRING_DATASOURCE_PASSWORD \ - SPRING_PROFILES_ACTIVE=$SPRING_PROFILES_ACTIVE \ - MYSQL_ROOT_PASSWORD=$MYSQL_ROOT_PASSWORD \ - MYSQL_DATABASE=$MYSQL_DATABASE \ - MYSQL_USER=$MYSQL_USER \ - MYSQL_PASSWORD=$MYSQL_PASSWORD \ - docker-compose down - sudo SPRING_DATASOURCE_URL=$SPRING_DATASOURCE_URL \ - SPRING_DATASOURCE_USERNAME=$SPRING_DATASOURCE_USERNAME \ - SPRING_DATASOURCE_PASSWORD=$SPRING_DATASOURCE_PASSWORD \ - SPRING_PROFILES_ACTIVE=$SPRING_PROFILES_ACTIVE \ - MYSQL_ROOT_PASSWORD=$MYSQL_ROOT_PASSWORD \ - MYSQL_DATABASE=$MYSQL_DATABASE \ - MYSQL_USER=$MYSQL_USER \ - MYSQL_PASSWORD=$MYSQL_PASSWORD \ - docker-compose up -d \ No newline at end of file + export SPRING_DATASOURCE_URL=$SPRING_DATASOURCE_URL + export SPRING_DATASOURCE_USERNAME=$SPRING_DATASOURCE_USERNAME + export SPRING_DATASOURCE_PASSWORD=$SPRING_DATASOURCE_PASSWORD + export SPRING_PROFILES_ACTIVE=$SPRING_PROFILES_ACTIVE + export MYSQL_ROOT_PASSWORD=$MYSQL_ROOT_PASSWORD + export MYSQL_DATABASE=$MYSQL_DATABASE + export MYSQL_USER=$MYSQL_USER + export MYSQL_PASSWORD=$MYSQL_PASSWORD + docker-compose down + docker-compose up -d \ No newline at end of file diff --git a/docker-compose.yml b/docker-compose.yml index a49bb40..1f7cd9f 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -6,6 +6,8 @@ services: container_name: mysql ports: - "3306:3306" + env_file: + - ./.env environment: MYSQL_ROOT_PASSWORD: ${MYSQL_ROOT_PASSWORD} MYSQL_DATABASE: ${MYSQL_DATABASE}