Skip to content

refactor: change docker restart to unless-stopped #19

refactor: change docker restart to unless-stopped

refactor: change docker restart to unless-stopped #19

Workflow file for this run

name: Backend Deploy
on:
push:
branches:
- main
paths:
- backend/**
- docker-compose.yaml
jobs:
deploy:
runs-on: ubuntu-latest
environment: prod
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup JDK 21
uses: actions/setup-java@v4
with:
java-version: 21
distribution: temurin
cache: gradle
- name: Build
working-directory: backend
run: |
chmod +x gradlew
./gradlew build -x test
- name: Setup environment variables
uses: appleboy/[email protected]
with:
host: ${{ secrets.HOST }}
username: ${{ secrets.USERNAME }}
key: ${{ secrets.KEY }}
script: |
cd ~/${{ github.event.repository.name }}
echo "JASYPT_PASSWORD=${{ secrets.JASYPT_PASSWORD }}" > .env
echo "MYSQL_ROOT_PASSWORD=${{ secrets.MYSQL_ROOT_PASSWORD }}" >> .env
- name: Copy jar
uses: appleboy/[email protected]
with:
host: ${{ secrets.HOST }}
username: ${{ secrets.USERNAME }}
key: ${{ secrets.KEY }}
source: docker-compose.yaml, backend/build/libs/
target: ~/${{ github.event.repository.name }}
- name: Restart docker compose
uses: appleboy/[email protected]
with:
host: ${{ secrets.HOST }}
username: ${{ secrets.USERNAME }}
key: ${{ secrets.KEY }}
script: |
cd ~/${{ github.event.repository.name }}
docker compose stop be
docker compose rm -f be
docker compose up -d be