OCI Image - Publish #33
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: Publish Docker Image | |
on: | |
schedule: | |
# Once weekly on fridays at noon | |
- cron: '00 12 * * 5' | |
workflow_dispatch: | |
jobs: | |
build-codegate-image: | |
name: Build Docker image | |
runs-on: ubuntu-latest-m | |
permissions: | |
contents: read | |
packages: write | |
actions: read | |
env: | |
BASE_REPO: "ghcr.io/stacklok" | |
CODEGATE_SERVER_IMAGE: "ghcr.io/stacklok/codegate/codegate" | |
steps: | |
- name: Checkout | |
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4 | |
- name: Set up QEMU for cross-platform builds | |
uses: docker/setup-qemu-action@49b3bc8e6bdd4a60e6116a5414239cba5943d3cf # v3 | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@c47758b77c9736f4b2ef4073d4d51994fabfe349 # v3 | |
- name: Compute version number | |
id: version-string | |
run: | | |
DATE="$(date +%Y%m%d)" | |
COMMIT="$(git rev-parse --short HEAD)" | |
echo "tag=0.$DATE.$GITHUB_RUN_NUMBER+ref.$COMMIT" >> "$GITHUB_OUTPUT" | |
- name: Login to GHCR | |
uses: docker/login-action@9780b0c442fbb1117ed29e0efdff1e18412f7567 # v3 | |
with: | |
registry: ghcr.io | |
username: ${{ github.actor }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- name: Set container metadata | |
uses: docker/metadata-action@369eb591f429131d6889c46b94e711f089e6ca96 # v5 | |
id: docker-metadata | |
with: | |
images: ${{ env.CODEGATE_SERVER_IMAGE }} | |
labels: | | |
org.opencontainers.image.source=${{ github.repositoryUrl }} | |
org.opencontainers.image.description="This is a container for the Stacklok Codegate server" | |
org.opencontainers.image.title="Stacklok Codegate Server" | |
org.opencontainers.image.vendor="Stacklok Inc." | |
org.opencontainers.image.version=${{ github.sha }} | |
flavor: | | |
latest=true | |
tags: | | |
type=raw,value=${{ steps.version-string.outputs.tag }} | |
- name: Download artifact | |
id: download-artifact | |
uses: dawidd6/action-download-artifact@v7 | |
with: | |
github_token: ${{ github.token }} | |
workflow: ".github/workflows/import_packages.yml" | |
workflow_conclusion: success | |
name: weaviate_data | |
name_is_regexp: true | |
skip_unpack: false | |
if_no_artifact_found: ignore | |
- name: Build image | |
id: image-build | |
uses: docker/build-push-action@48aba3b46d1b1fec4febb7c5d0c644b249a11355 # v5 | |
with: | |
github_token: ${{ github.token }} | |
context: . | |
platforms: linux/amd64,linux/arm64 | |
push: true | |
file: ./Dockerfile | |
tags: ${{ steps.docker-metadata.outputs.tags }} | |
labels: ${{ steps.docker-metadata.outputs.labels }} | |
cache-from: type=gha | |
cache-to: type=gha,mode=max |