Skip to content

Commit

Permalink
feat: added dockerhub push and pull stages
Browse files Browse the repository at this point in the history
  • Loading branch information
proffapt committed Jun 30, 2024
1 parent 256ba6d commit 24de776
Showing 1 changed file with 35 additions and 7 deletions.
42 changes: 35 additions & 7 deletions .github/workflows/deploy.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,39 @@ on:
- "**.md"
- "LICENSE"
- "LICENSE.txt"
- ".gitignore"
- "frontend/**"

jobs:
dockerhub:
name: Publish Docker Image(s) to Dockerhub
runs-on: ubuntu-latest

steps:
- name: Checkout Repository
uses: actions/checkout@v4

- 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_PASSWORD }}

- name: Build & Push
uses: docker/build-push-action@v5
with:
context: .
push: true
tags: ${{ secrets.DOCKERHUB_USERNAME }}/CONTAINER_NAME:latest

push:
name: Push Stage
name: Push Code Stage
needs: dockerhub
runs-on: ubuntu-latest

steps:
Expand All @@ -32,13 +60,13 @@ jobs:
sudo git fetch origin
sudo git reset --hard origin/main
build:
name: Build Stage
pull:
name: Pull Image Stage
needs: push
runs-on: ubuntu-latest

steps:
- name: Build the latest container(s)
- name: Pull the latest images(s)
uses: appleboy/ssh-action@master
env:
PROJECT_DIR: ${{ secrets.PROJECT_DIR }}
Expand All @@ -51,11 +79,11 @@ jobs:
script_stop: true
script: |
cd "${PROJECT_DIR}/"
sudo docker compose build
sudo docker compose pull
deploy:
name: Deploy Stage
needs: [push, build]
needs: pull
runs-on: ubuntu-latest

steps:
Expand Down

0 comments on commit 24de776

Please sign in to comment.