Skip to content

Commit

Permalink
chore: Add docker image push workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
jsakv committed Jul 26, 2024
1 parent d6a6ea4 commit 5c6d985
Showing 1 changed file with 35 additions and 0 deletions.
35 changes: 35 additions & 0 deletions .github/workflows/push.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
name: push
on:
push:
branches: [ main ]

env:
IMAGE_NAME: pyro-risks
DOCKERHUB_USER: ${{ secrets.DOCKERHUB_LOGIN }}

jobs:
docker:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Build docker
run: docker compose build -t $DOCKERHUB_USER/$IMAGE_NAME:latest
- name: Login to DockerHub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKERHUB_LOGIN }}
password: ${{ secrets.DOCKERHUB_PW }}
- name: Push to hub
run: docker push $DOCKERHUB_USER/$IMAGE_NAME:latest
- name: Login to GHCR
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Push to container registry
run: |
IMAGE_ID=ghcr.io/${{ github.repository_owner }}/$IMAGE_NAME
IMAGE_ID=$(echo $IMAGE_ID | tr '[A-Z]' '[a-z]')
docker tag $DOCKERHUB_USER/$IMAGE_NAME:latest $IMAGE_ID:latest
docker push $IMAGE_ID:latest

0 comments on commit 5c6d985

Please sign in to comment.