-
Notifications
You must be signed in to change notification settings - Fork 169
143 lines (129 loc) · 5.53 KB
/
publish-docker-images.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
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@v4
- name: Download Linux Release Artifacts
uses: actions/download-artifact@v4
with:
name: linux-release-${{ github.run_id }}
path: release/
- name: Set Up QEMU
uses: docker/setup-qemu-action@v3
with:
platforms: amd64,arm64
- name: Set Up Docker BuildKit
id: buildx
uses: docker/setup-buildx-action@v3
- name: Login to Docker Hub
uses: docker/login-action@v3
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
shell: bash
run: |
DOCKER_TAGS="${IMAGE_REPO}:${IMAGE_TAG}"
echo DOCKER_TAGS="${DOCKER_TAGS}" | tee -a $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@v6
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
shell: bash
run: |
DOCKER_TAGS="${IMAGE_REPO}:${IMAGE_TAG}"
echo DOCKER_TAGS="${DOCKER_TAGS}" | tee -a $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@v6
with:
builder: ${{ steps.buildx.outputs.name }}
context: ${{ github.workspace }}/
file: ${{ github.workspace }}/dist/docker-images/ziti-controller/Dockerfile
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 }}
DOCKER_BUILD_DIR=./dist/docker-images/ziti-controller
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
shell: bash
run: |
DOCKER_TAGS="${IMAGE_REPO}:${IMAGE_TAG}"
echo DOCKER_TAGS="${DOCKER_TAGS}" | tee -a $GITHUB_OUTPUT
- name: Build & Push Multi-Platform Router Container Image to Hub
uses: docker/build-push-action@v6
with:
builder: ${{ steps.buildx.outputs.name }}
context: ${{ github.workspace }}/
file: ${{ github.workspace }}/dist/docker-images/ziti-router/Dockerfile
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 }}
DOCKER_BUILD_DIR=./dist/docker-images/ziti-router
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 }}
id: tagprep_tun
shell: bash
run: |
DOCKER_TAGS="${IMAGE_REPO}:${IMAGE_TAG}"
echo DOCKER_TAGS="${DOCKER_TAGS}" | tee -a $GITHUB_OUTPUT
- name: Build & Push Multi-Platform Go Tunneler Container Image to Hub
uses: docker/build-push-action@v6
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