Skip to content

Build and Push Docker Image #6

Build and Push Docker Image

Build and Push Docker Image #6

Workflow file for this run

name: Build and Push Docker Image
on:
schedule:
# Run at 9:00 AM Central Time (US/Chicago) every Friday
- cron: '0 14 * * 5'
# Allow manual triggering
workflow_dispatch:
jobs:
build-and-push:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 #v4.2.2
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@b5ca514318bd6ebac0fb2aedd5d36ec1b5c232a2 #v3.10.0
- name: Log in to Docker Hub
uses: docker/login-action@74a5d142397b4f367a81961eba4e8cd7edddf772 #v3.4.0
with:
username: esacteksab
password: ${{ secrets.DOCKERHUB_TOKEN }}
# Get current date in YYYY-MM-DD format
- name: Get current date
id: date
run: echo "date=$(date +'%Y-%m-%d')" >> $GITHUB_OUTPUT
- name: Build and push Docker image
uses: docker/build-push-action@263435318d21b8e681c14492fe198d362a7d2c83 #v6.18.0
with:
context: .
push: true
tags: |
esacteksab/go:latest
esacteksab/go:${{ vars.GO_VERSION }}
esacteksab/go:${{ vars.GO_VERSION }}-${{ steps.date.outputs.date }}
build-args: |
GO_VERSION=${{ vars.GO_VERSION }}
cache-from: type=gha
cache-to: type=gha,mode=max