Skip to content

Build Production Image #15

Build Production Image

Build Production Image #15

name: Build Production Image
on:
release:
types: [published]
env:
REGISTRY: ghcr.io
IMAGE_NAME: ${{ github.repository }}
jobs:
build:
name: Build Production Image
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
steps:
- name: Checkout repository
uses: actions/checkout@v3
- name: Log in to the Container registry
uses: docker/login-action@v2
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Set up Docker Buildx
id: buildx
uses: docker/setup-buildx-action@v2
# Save the date and tag name for this release
# as variables
- name: Get release info
id: release_info
run: |
echo "date=$(date +'%Y-%m-%d')" >> $GITHUB_OUTPUT
echo "tag=${GITHUB_REF#refs/*/}" >> $GITHUB_OUTPUT
- name: Build and push Docker image
uses: docker/build-push-action@v4
with:
context: ./txpipe
file: ./txpipe/Dockerfile
# These arguments get passed into the docker image itself
build-args: |
TX_DOCKER_VERSION=${{ github.sha }}
TX_RELEASE_DATE=${{ steps.release_info.outputs.date }}
TX_RELEASE_TAG=${{ steps.release_info.outputs.tag }}
push: true
# We use four tags for release builds:
# txpipe
# txpipe:latest
# txpipe:<the date, e.g. 2023-03-21>
# txpipe:<the release tag, e.g. v0.3>
tags: ghcr.io/lsstdesc/txpipe,ghcr.io/lsstdesc/txpipe:latest,ghcr.io/lsstdesc/txpipe:${{ steps.release_info.outputs.date }},ghcr.io/lsstdesc/txpipe:${{ steps.release_info.outputs.tag }}
cache-from: type=gha
cache-to: type=gha,mode=max