Build and Publish Docker Image for Snapshot #188
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Build and Publish Docker Image for Snapshot | |
env: | |
GO_VERSION: '1.22.4' | |
SERVICE_NAME: 'service-template' | |
ALPINE_VERSION: '3.20' | |
on: | |
release: | |
types: [ published ] | |
schedule: | |
- cron: '20 20 * * *' | |
workflow_dispatch: | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@c47758b77c9736f4b2ef4073d4d51994fabfe349 # v3.7.1 | |
- name: Optionally, login to Docker repository | |
uses: docker/login-action@9780b0c442fbb1117ed29e0efdff1e18412f7567 # v3.3.0 | |
env: | |
DOCKER_USERNAME: ${{ secrets.DOCKER_USERNAME }} | |
if: env.DOCKER_USERNAME != null | |
with: | |
username: ${{ secrets.DOCKER_USERNAME }} | |
password: ${{ secrets.DOCKER_PASSWORD }} | |
- name: Build and push Docker image | |
uses: docker/build-push-action@48aba3b46d1b1fec4febb7c5d0c644b249a11355 # v6.10.0 | |
with: | |
context: . | |
file: ./Dockerfile | |
push: true | |
tags: ${{ vars.DOCKER_REGISTRY_ACCOUNT }}/${{ env.SERVICE_NAME }}:nightly | |
build-args: | | |
GO_VERSION=${{ env.GO_VERSION }} | |
ALPINE_VERSION=${{ env.ALPINE_VERSION }} | |
SERVICE_NAME=${{ env.SERVICE_NAME }} | |
labels: | | |
org.opencontainers.image.source=https://github.com/uclalibrary/${{ env.SERVICE_NAME }} | |
org.opencontainers.image.description=UCLA Library's ${{ env.SERVICE_NAME }} |