Skip to content

Commit

Permalink
Add dockerhub push action
Browse files Browse the repository at this point in the history
  • Loading branch information
safts committed Jul 29, 2024
1 parent 3d4af44 commit 3de0975
Showing 1 changed file with 44 additions and 0 deletions.
44 changes: 44 additions & 0 deletions .github/workflows/build-and-push.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
name: CI Workflow

on:
push:
branches:
- main
pull_request:
branches:
- main

jobs:
build-test:
runs-on: ubuntu-latest

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

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3

- name: Login to DockerHub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_PASSWORD }}

- name: Lint the code
id: lint
run: |
docker build --build-arg APP_ENV=test -t lint-test-image .
docker run --rm --entrypoint pre-commit lint-test-image run --all-files
- name: Build and push Docker image
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
uses: docker/build-push-action@v6
with:
context: .
file: ./Dockerfile
# No need to build for anything other than arm64 currently
# platforms: linux/amd64,linux/arm64
platforms: linux/arm64
push: true
tags: ${{ secrets.DOCKERHUB_USERNAME }}/rpi5-k8s-node-bootstrapper:latest,${{ secrets.DOCKERHUB_USERNAME }}/rpi5-k8s-node-bootstrapper:${{ github.sha }}

0 comments on commit 3de0975

Please sign in to comment.