Skip to content

Commit

Permalink
[Feature/#313] CI/CD docker hub 도입
Browse files Browse the repository at this point in the history
[Feature/#313] CI/CD docker hub 도입
  • Loading branch information
whitem4rk authored Jun 18, 2024
2 parents 7d82523 + ce11ab6 commit 5722d90
Show file tree
Hide file tree
Showing 4 changed files with 70 additions and 4 deletions.
23 changes: 20 additions & 3 deletions .github/workflows/deploy-dev.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ on:
workflow_dispatch:

jobs:
build:
deploy:
runs-on: ubuntu-latest

steps:
Expand Down Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/depoly-production.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ on:
- release-*

jobs:
build:
deploy:
runs-on: ubuntu-latest

steps:
Expand Down
12 changes: 12 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -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"]
37 changes: 37 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -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"]

0 comments on commit 5722d90

Please sign in to comment.