Skip to content

Docker Image Build and Push #63

Docker Image Build and Push

Docker Image Build and Push #63

Workflow file for this run

name: Docker Image Build and Push
on:
schedule:
- cron: "0 0 */7 * *" # every 7 days
push:
branches:
- main
paths:
- "Dockerfile"
- ".github/workflows/docker_build.yml"
pull_request:
branches:
- main
paths:
- "Dockerfile"
- ".github/workflows/docker_build.yml"
types: [opened, synchronize, reopened, ready_for_review]
#workflow_dispatch: # Add this line to enable manual trigger
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Free Disk Space (Ubuntu)
uses: jlumbroso/free-disk-space@main
with:
tool-cache: false
android: true
dotnet: true
haskell: true
large-packages: true
docker-images: false
swap-storage: true
- name: Checkout
uses: actions/checkout@v2
- name: Build Docker Image (No Push)
if: github.event_name == 'pull_request' || (github.event_name == 'push' && github.ref != 'refs/heads/main')
uses: docker/[email protected]
with:
context: .
file: ./Dockerfile
push: false
- name: Login to Docker Hub
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
uses: docker/[email protected]
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Set up Docker Buildx
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
uses: docker/[email protected]
- name: Build and Push Docker Image
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
uses: docker/[email protected]
with:
context: .
file: ./Dockerfile
push: true
tags: ${{ secrets.DOCKERHUB_USERNAME }}/arc:latest