diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml index 8c6fef6..8743495 100644 --- a/.github/workflows/deploy.yml +++ b/.github/workflows/deploy.yml @@ -24,7 +24,7 @@ jobs: - name: 테스트 및 빌드하기 run: | chmod +x ./gradlew - ./gradlew clean build -x test + ./gradlew clean build - name: AWS Resource에 접근할 수 있게 AWS credentials 설정 uses: aws-actions/configure-aws-credentials@v4 @@ -54,7 +54,11 @@ jobs: key: ${{ secrets.EC2_PRIVATE_KEY }} script_stop: true script: | - docker stop cano-server || true - docker rm cano-server || true - docker pull ${{ steps.login-ecr.outputs.registry }}/cano-server:latest - docker run -d --name cano-server --network cano-network -p 8080:8080 ${{ steps.login-ecr.outputs.registry }}/cano-server:latest \ No newline at end of file + cd /cano-server + docker compose down || true + docker compose pull + docker compose up -d +# docker stop cano-server || true +# docker rm cano-server || true +# docker pull ${{ steps.login-ecr.outputs.registry }}/cano-server:latest +# docker run -d --name cano-server -p 8080:8080 ${{ steps.login-ecr.outputs.registry }}/cano-server:latest \ No newline at end of file diff --git a/Dockerfile b/Dockerfile index d876304..bffb56b 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,4 +1,3 @@ FROM eclipse-temurin:17-jdk-alpine COPY ./build/libs/*SNAPSHOT.jar app.jar -EXPOSE 8080 ENTRYPOINT ["java", "-jar", "app.jar"] \ No newline at end of file diff --git a/docker-compose.yml b/docker-compose.yml new file mode 100644 index 0000000..d95c9e0 --- /dev/null +++ b/docker-compose.yml @@ -0,0 +1,22 @@ +services: + cano-server: + image: 992382507226.dkr.ecr.ap-northeast-2.amazonaws.com/cano-server + ports: + - 8080:8080 + depends_on: + - my-db: + condition: service_healthy + + my-db: + image: mysql + environment: + MYSQL_ROOT_PASSWORD: password123 + MYSQL_DATABASE: cano + volumes: + - ./mysql-data:/var/lib/mysql + ports: + - 3306:3306 + healthcheck: + test: [ "CMD", "mysqladmin", "ping" ] + interval: 5s + retries: 10 \ No newline at end of file