Skip to content

Merge pull request #281 from TheUpperPart/Design/#280 #18

Merge pull request #281 from TheUpperPart/Design/#280

Merge pull request #281 from TheUpperPart/Design/#280 #18

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/ssh-action@v0.1.6
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