Skip to content

Commit d2ead98

Browse files
authored
[FLINK-27671] Add arm support for snapshot docker images
1 parent 4a28c61 commit d2ead98

File tree

2 files changed

+65
-16
lines changed

2 files changed

+65
-16
lines changed

.github/workflows/docker-bake.hcl

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
################################################################################
2+
# Licensed to the Apache Software Foundation (ASF) under one
3+
# or more contributor license agreements. See the NOTICE file
4+
# distributed with this work for additional information
5+
# regarding copyright ownership. The ASF licenses this file
6+
# to you under the Apache License, Version 2.0 (the
7+
# "License"); you may not use this file except in compliance
8+
# with the License. You may obtain a copy of the License at
9+
#
10+
# http://www.apache.org/licenses/LICENSE-2.0
11+
#
12+
# Unless required by applicable law or agreed to in writing, software
13+
# distributed under the License is distributed on an "AS IS" BASIS,
14+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15+
# See the License for the specific language governing permissions and
16+
# limitations under the License.
17+
################################################################################
18+
19+
variable TAG {
20+
default = "latest-snapshot"
21+
}
22+
23+
variable DOCKER_FILE {
24+
default = "Dockerfile"
25+
}
26+
27+
target "bake-platform" {
28+
inherits = ["docker-metadata-action"]
29+
dockerfile = "$DOCKER_FILE"
30+
context = "./"
31+
tags = ["${TAG}"]
32+
platforms = [
33+
"linux/amd64",
34+
"linux/arm64/v8",
35+
]
36+
}

.github/workflows/snapshot.yml

Lines changed: 29 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -48,26 +48,39 @@ jobs:
4848
- uses: actions/checkout@v3
4949
with:
5050
ref: ${{ matrix.build.branch }}
51-
- name: Set env
51+
52+
- name: Set up QEMU
53+
uses: docker/setup-qemu-action@v1
54+
with:
55+
image: tonistiigi/binfmt:latest
56+
platforms: all
57+
58+
- name: Set up Docker Buildx
59+
uses: docker/setup-buildx-action@v1
60+
61+
- name: Log in to the Container registry
62+
uses: docker/login-action@v1
63+
with:
64+
registry: ghcr.io
65+
username: ${{ github.actor }}
66+
password: ${{ secrets.GITHUB_TOKEN }}
67+
68+
- name: Prepare Dockerfiles and set env
5269
run: |
5370
IMAGE_NAME=${{ matrix.build.flink_version }}-scala_2.12-java${{ matrix.java_version }}
5471
echo "IMAGE_NAME=${IMAGE_NAME}" >> $GITHUB_ENV
5572
echo "TAG=${REGISTRY}/${OWNER}/${IMAGE_REPO}:${IMAGE_NAME}-debian" >> $GITHUB_ENV
73+
./add-custom.sh -u "https://s3.amazonaws.com/flink-nightly/flink-${{ matrix.build.flink_version }}-bin-scala_2.12.tgz" -j ${{ matrix.java_version }} -n ${IMAGE_NAME}
74+
echo "DOCKER_FILE=$(ls ./*/*${{ matrix.build.flink_version }}*${{ matrix.java_version }}*/Dockerfile)" >> $GITHUB_ENV
75+
5676
- name: Environment
5777
run: env
58-
- name: Prepare Dockerfiles
59-
run: |
60-
./add-custom.sh -u "https://s3.amazonaws.com/flink-nightly/flink-${{ matrix.build.flink_version }}-bin-scala_2.12.tgz" -j ${{ matrix.java_version }} -n ${IMAGE_NAME}
61-
- name: Build image
62-
run: |
63-
dockerfile="$(ls ./*/*${{ matrix.build.flink_version }}*${{ matrix.java_version }}*/Dockerfile)"
64-
dockerfile_dir="$(dirname "$dockerfile")"
65-
echo "===> Building ${TAG} image from ${dockerfile_dir}"
66-
docker build -t ${TAG} ${dockerfile_dir}
67-
- name: Docker login
68-
run: |
69-
docker login ${REGISTRY} -u ${{ github.actor }} -p ${{ secrets.GITHUB_TOKEN }}
70-
- name: "Publish snapshots"
71-
run: |
72-
docker push "${TAG}"
7378

79+
- name: Build and push Docker images (supported platforms)
80+
uses: docker/[email protected]
81+
with:
82+
files: |
83+
.github/workflows/docker-bake.hcl
84+
${{ steps.meta.outputs.bake-file }}
85+
targets: bake-platform
86+
push: ${{ github.event_name != 'pull_request' }}

0 commit comments

Comments
 (0)