Skip to content

Merge pull request #279 from TheUpperPart/Feat/#274 #17

Merge pull request #279 from TheUpperPart/Feat/#274

Merge pull request #279 from TheUpperPart/Feat/#274 #17

Workflow file for this run

name: CD Workflow
on:
push:
branches: ["dev", "HotFix/**"]
jobs:
docker:
timeout-minutes: 10
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Docker Image Build
run: docker build -t ${{ secrets.DOCKERHUB_REGISTRY }}/${{ secrets.DOCKERHUB_IMAGE_NAME }} -f dockerfile.prod .
- name: Login DockerHub
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_PW }}
- name: DockerHub Push
run: docker push ${{ secrets.DOCKERHUB_REGISTRY }}/${{ secrets.DOCKERHUB_IMAGE_NAME }}
- name: EC2 Login
uses: appleboy/[email protected]
with:
host: ${{ secrets.HOST_NAME }}
username: ${{secrets.USER_NAME }}
key: ${{ secrets.SERVER_SSH_KEY }}
script: |
docker-compose down
docker image prune
docker rm $(docker ps -a -q)
docker pull ${{ secrets.DOCKERHUB_REGISTRY }}/${{ secrets.DOCKERHUB_IMAGE_NAME }}
docker-compose up -d