Skip to content

Commit

Permalink
[Feat] Actions로 배포를 적용한다.
Browse files Browse the repository at this point in the history
  • Loading branch information
kurtyoon authored Dec 18, 2023
1 parent 218a5fe commit 0a8a82a
Show file tree
Hide file tree
Showing 2 changed files with 50 additions and 1 deletion.
49 changes: 49 additions & 0 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
name: deploy-actions

on:
push:
branches: [prod]

jobs:
ci:
runs-on: ubuntu-20.04

steps:
- name: Checkout
uses: actions/checkout@v3
with:
token: ${{ secrets.GIT_TOKEN }}
submodules: true

- name: Login to Docker Hub
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2

- name: Build and Push Docker images
run: |
docker build -t ${{ secrets.DOCKERHUB_USERNAME }}/${{ secrets.DOCKERHUB_REPOSITORY }} .
docker push {{ secrets.DOCKERHUB_USERNAME }}/${{ secrets.DOCKERHUB_REPOSITORY }}:latest
cd:
needs: [ci]
runs-on: ubuntu-20.04

steps:
- name: Docker Image Pull And Container Run
uses: appleboy/[email protected]
with:
host: ${{ secrets.HOST }}
username: ${{ secrets.USERNAME }}
password: ${{ secrets.PASSWORD }}
port: ${{ secrets.PORT }}
script: |
docker compose down
docker system prune -a
docker compose pull
docker compose up -d
2 changes: 1 addition & 1 deletion src/main/resources/application.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
spring.profiles.default: local
spring.profiles.default: prod

---

Expand Down

0 comments on commit 0a8a82a

Please sign in to comment.