mirror of
https://github.com/openziti/ziti.git
synced 2026-10-12 23:32:02 +00:00
160 lines
6.2 KiB
YAML
160 lines
6.2 KiB
YAML
name: Publish Docker Images
|
|
|
|
on:
|
|
workflow_call:
|
|
inputs:
|
|
ziti-tag:
|
|
description: Image tag to publish for ziti container images
|
|
type: string
|
|
required: true
|
|
|
|
jobs:
|
|
publish-docker-images:
|
|
runs-on: ubuntu-latest
|
|
env:
|
|
ZITI_CLI_TAG: ${{ inputs.ziti-tag || github.event.inputs.ziti-tag }}
|
|
ZITI_CLI_IMAGE: ${{ vars.ZITI_CLI_IMAGE || 'docker.io/openziti/ziti-cli' }}
|
|
ZITI_CONTROLLER_IMAGE: ${{ vars.ZITI_CONTROLLER_IMAGE || 'docker.io/openziti/ziti-controller' }}
|
|
ZITI_ROUTER_IMAGE: ${{ vars.ZITI_ROUTER_IMAGE || 'docker.io/openziti/ziti-router' }}
|
|
ZITI_TUNNEL_IMAGE: ${{ vars.ZITI_TUNNEL_IMAGE || 'docker.io/openziti/ziti-tunnel' }}
|
|
steps:
|
|
- name: Checkout Workspace
|
|
uses: actions/checkout@v3
|
|
|
|
- name: Download Linux Release Artifacts
|
|
uses: actions/download-artifact@v3
|
|
with:
|
|
name: linux-release-${{ github.run_id }}
|
|
path: release/
|
|
|
|
- name: Set Up QEMU
|
|
uses: docker/setup-qemu-action@v2
|
|
with:
|
|
platforms: amd64,arm64
|
|
|
|
- name: Set Up Docker BuildKit
|
|
id: buildx
|
|
uses: docker/setup-buildx-action@v2
|
|
|
|
- name: Login to Docker Hub
|
|
uses: docker/login-action@v2
|
|
with:
|
|
# it is preferable to obtain the username from a var so that
|
|
# recurrences of the same string are not masked in CI output
|
|
username: ${{ vars.DOCKER_HUB_API_USER || secrets.DOCKER_HUB_API_USER }}
|
|
password: ${{ secrets.DOCKER_HUB_API_TOKEN }}
|
|
|
|
- name: Set Up Container Image Tags for Base CLI Container
|
|
env:
|
|
IMAGE_REPO: ${{ env.ZITI_CLI_IMAGE }}
|
|
IMAGE_TAG: ${{ env.ZITI_CLI_TAG }}
|
|
id: tagprep_cli
|
|
run: |
|
|
DOCKER_TAGS=""
|
|
DOCKER_TAGS="${IMAGE_REPO}:${IMAGE_TAG}"
|
|
if [[ "${{ github.ref }}" == "refs/heads/main" ]]; then
|
|
DOCKER_TAGS+=",${IMAGE_REPO}:latest"
|
|
fi
|
|
echo "DEBUG: DOCKER_TAGS=${DOCKER_TAGS}"
|
|
echo DOCKER_TAGS="${DOCKER_TAGS}" >> $GITHUB_OUTPUT
|
|
|
|
# this is the base image into which is stuffed the Linux binary for each
|
|
# arch that was downloaded in ./release/, hence the need to specify the
|
|
# Dockerfile and DOCKER_BUILD_DIR
|
|
- name: Build & Push Multi-Platform CLI Container Image to Hub
|
|
uses: docker/build-push-action@v3
|
|
with:
|
|
builder: ${{ steps.buildx.outputs.name }}
|
|
context: ${{ github.workspace }}/
|
|
file: ${{ github.workspace }}/dist/docker-images/ziti-cli/Dockerfile
|
|
platforms: linux/amd64,linux/arm64
|
|
tags: ${{ steps.tagprep_cli.outputs.DOCKER_TAGS }}
|
|
build-args: |
|
|
DOCKER_BUILD_DIR=./dist/docker-images/ziti-cli
|
|
push: true
|
|
|
|
- name: Set Up Container Image Tags for Controller Container
|
|
env:
|
|
IMAGE_REPO: ${{ env. ZITI_CONTROLLER_IMAGE }}
|
|
IMAGE_TAG: ${{ env.ZITI_CLI_TAG }}
|
|
id: tagprep_ctrl
|
|
run: |
|
|
DOCKER_TAGS=""
|
|
DOCKER_TAGS="${IMAGE_REPO}:${IMAGE_TAG}"
|
|
if [[ "${{ github.ref }}" == "refs/heads/main" ]]; then
|
|
DOCKER_TAGS+=",${IMAGE_REPO}:latest"
|
|
fi
|
|
echo "DEBUG: DOCKER_TAGS=${DOCKER_TAGS}"
|
|
echo DOCKER_TAGS="${DOCKER_TAGS}" >> $GITHUB_OUTPUT
|
|
|
|
# This is a use-case image based on the minimal CLI image. It needs the
|
|
# ZITI_CLI_TAG env var so it can build from the versioned image that
|
|
# we pushed in the prior step.
|
|
- name: Build & Push Multi-Platform Controller Container Image to Hub
|
|
uses: docker/build-push-action@v3
|
|
with:
|
|
builder: ${{ steps.buildx.outputs.name }}
|
|
context: ${{ github.workspace }}/dist/docker-images/ziti-controller/
|
|
platforms: linux/amd64,linux/arm64
|
|
tags: ${{ steps.tagprep_ctrl.outputs.DOCKER_TAGS }}
|
|
build-args: |
|
|
ZITI_CLI_TAG=${{ env.ZITI_CLI_TAG }}
|
|
ZITI_CLI_IMAGE=${{ env.ZITI_CLI_IMAGE }}
|
|
push: true
|
|
|
|
- name: Set Up Container Image Tags for Router Container
|
|
env:
|
|
IMAGE_REPO: ${{ env.ZITI_ROUTER_IMAGE }}
|
|
IMAGE_TAG: ${{ env.ZITI_CLI_TAG }}
|
|
id: tagprep_router
|
|
run: |
|
|
DOCKER_TAGS=""
|
|
DOCKER_TAGS="${IMAGE_REPO}:${IMAGE_TAG}"
|
|
if [[ "${{ github.ref }}" == "refs/heads/main" ]]; then
|
|
DOCKER_TAGS+=",${IMAGE_REPO}:latest"
|
|
fi
|
|
echo "DEBUG: DOCKER_TAGS=${DOCKER_TAGS}"
|
|
echo DOCKER_TAGS="${DOCKER_TAGS}" >> $GITHUB_OUTPUT
|
|
|
|
- name: Build & Push Multi-Platform Router Container Image to Hub
|
|
uses: docker/build-push-action@v3
|
|
with:
|
|
builder: ${{ steps.buildx.outputs.name }}
|
|
context: ${{ github.workspace }}/dist/docker-images/ziti-router/
|
|
platforms: linux/amd64,linux/arm64
|
|
tags: ${{ steps.tagprep_router.outputs.DOCKER_TAGS }}
|
|
build-args: |
|
|
ZITI_CLI_TAG=${{ env.ZITI_CLI_TAG }}
|
|
ZITI_CLI_IMAGE=${{ env.ZITI_CLI_IMAGE }}
|
|
push: true
|
|
|
|
- name: Set Up Container Image Tags for Go Tunneler Container
|
|
env:
|
|
IMAGE_REPO: ${{ env.ZITI_TUNNEL_IMAGE }}
|
|
IMAGE_TAG: ${{ env.ZITI_CLI_TAG }}
|
|
LEGACY_REPO: netfoundry/ziti-tunnel
|
|
id: tagprep_tun
|
|
run: |
|
|
DOCKER_TAGS=""
|
|
for REPO in ${LEGACY_REPO} ${IMAGE_REPO}; do
|
|
DOCKER_TAGS="${IMAGE_REPO}:${IMAGE_TAG}"
|
|
if [[ "${{ github.ref }}" == "refs/heads/main" ]]; then
|
|
DOCKER_TAGS+=",${IMAGE_REPO}:latest"
|
|
fi
|
|
done
|
|
DOCKER_TAGS=${DOCKER_TAGS#,} # drop leading comma char
|
|
echo "DEBUG: DOCKER_TAGS=${DOCKER_TAGS}"
|
|
echo DOCKER_TAGS="${DOCKER_TAGS}" >> $GITHUB_OUTPUT
|
|
|
|
- name: Build & Push Multi-Platform Go Tunneler Container Image to Hub
|
|
uses: docker/build-push-action@v3
|
|
with:
|
|
builder: ${{ steps.buildx.outputs.name }}
|
|
context: ${{ github.workspace }}/dist/docker-images/ziti-tunnel/
|
|
platforms: linux/amd64,linux/arm64
|
|
tags: ${{ steps.tagprep_tun.outputs.DOCKER_TAGS }}
|
|
build-args: |
|
|
ZITI_CLI_TAG=${{ env.ZITI_CLI_TAG }}
|
|
ZITI_CLI_IMAGE=${{ env.ZITI_CLI_IMAGE }}
|
|
push: true
|