From cff1e978ec0388963e3dfca0de24638ab9b3f204 Mon Sep 17 00:00:00 2001 From: whitemark Date: Tue, 18 Jun 2024 18:10:09 +0900 Subject: [PATCH 1/2] =?UTF-8?q?[feature/#313]=20Docker=20=EA=B4=80?= =?UTF-8?q?=EB=A0=A8=20=EC=84=A4=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Dockerfile | 12 ++++++++++++ docker-compose.yml | 37 +++++++++++++++++++++++++++++++++++++ 2 files changed, 49 insertions(+) create mode 100644 Dockerfile create mode 100644 docker-compose.yml diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 00000000..f38b07f4 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,12 @@ +FROM openjdk:11-jre-slim as spring + +ARG JAR_FILE=./resource-server/build/libs/resource-server-0.0.1-SNAPSHOT.jar + +EXPOSE 8080 +EXPOSE 8081 +EXPOSE 8082 +EXPOSE 8083 + +COPY ${JAR_FILE} app.jar + +CMD ["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 00000000..65ad297e --- /dev/null +++ b/docker-compose.yml @@ -0,0 +1,37 @@ +version: '3' +services: + prod1: + image: whtmdgus56/ibas-config:prod + container_name: backend/prod1 + ports: + - "8080:8080" + environment: + - SPRING_PROFILES_ACTIVE=prod1 + entrypoint: ["java", "-jar", "app.jar", "--spring.profiles.active=prod1"] + + prod2: + image: whtmdgus56/ibas-config:prod + container_name: backend/prod2 + ports: + - "8081:8081" + environment: + - SPRING_PROFILES_ACTIVE=prod2 + entrypoint: ["java", "-jar", "app.jar", "--spring.profiles.active=prod2"] + + dev1: + image: whtmdgus56/ibas-config:dev + container_name: backend/dev1 + ports: + - "8082:8082" + environment: + - SPRING_PROFILES_ACTIVE=dev1 + entrypoint: ["java", "-jar", "app.jar", "--spring.profiles.active=dev1"] + + dev2: + image: whtmdgus56/ibas-config:dev + container_name: backend/dev2 + ports: + - "8083:8083" + environment: + - SPRING_PROFILES_ACTIVE=dev2 + entrypoint: ["java", "-jar", "app.jar", "--spring.profiles.active=dev2"] From ce11ab6cbdce592eb04950a232a542a38781392e Mon Sep 17 00:00:00 2001 From: whitemark Date: Tue, 18 Jun 2024 18:11:14 +0900 Subject: [PATCH 2/2] =?UTF-8?q?[feature/#313]=20github=20actions=20Docker?= =?UTF-8?q?=20hub=20=EA=B4=80=EB=A0=A8=20=EC=84=A4=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/deploy-dev.yml | 23 ++++++++++++++++++++--- .github/workflows/depoly-production.yml | 2 +- 2 files changed, 21 insertions(+), 4 deletions(-) diff --git a/.github/workflows/deploy-dev.yml b/.github/workflows/deploy-dev.yml index 50f1f05f..cfb41219 100644 --- a/.github/workflows/deploy-dev.yml +++ b/.github/workflows/deploy-dev.yml @@ -7,7 +7,7 @@ on: workflow_dispatch: jobs: - build: + deploy: runs-on: ubuntu-latest steps: @@ -37,9 +37,26 @@ jobs: key: ${{ secrets.IBAS_DEV_SSH_KEY }} passphrase: ${{ secrets.IBAS_DEV_PASSWORD }} # port: ${{ secrets.PORT }} # default : 22 - source: "resource-server/build/libs/resource-server-0.0.1-SNAPSHOT.jar" + source: "docker-compose.yml" target: ${{ secrets.IBAS_DEV_DEPLOY_PATH }} - strip_components: 3 + + - name: Set up QEMU + uses: docker/setup-qemu-action@v3 + + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v3 + + - name: Login to Docker Hub + uses: docker/login-action@v3 + with: + username: ${{ secrets.DOCKERHUB_USERNAME }} + password: ${{ secrets.DOCKERHUB_TOKEN }} + + - name: Build and push + uses: docker/build-push-action@v6 + with: + push: true + tags: ${{ secrets.DOCKERHUB_STORAGE }}:dev - name: execute deploy shell script via ssh uses: appleboy/ssh-action@master diff --git a/.github/workflows/depoly-production.yml b/.github/workflows/depoly-production.yml index 454901e7..a050863b 100644 --- a/.github/workflows/depoly-production.yml +++ b/.github/workflows/depoly-production.yml @@ -6,7 +6,7 @@ on: - release-* jobs: - build: + deploy: runs-on: ubuntu-latest steps: