Skip to content

Commit cfeea17

Browse files
gaborgsomogyimbalassi
authored andcommitted
Add docker build workflow
1 parent 9391951 commit cfeea17

File tree

11 files changed

+328
-63
lines changed

11 files changed

+328
-63
lines changed

.github/workflows/docker_push.yml

Lines changed: 148 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,148 @@
1+
# Licensed to the Apache Software Foundation (ASF) under one or more
2+
# contributor license agreements. See the NOTICE file distributed with
3+
# this work for additional information regarding copyright ownership.
4+
# The ASF licenses this file to You under the Apache License, Version 2.0
5+
# (the "License"); you may not use this file except in compliance with
6+
# the License. You may obtain a copy of the License at
7+
#
8+
# http://www.apache.org/licenses/LICENSE-2.0
9+
#
10+
# Unless required by applicable law or agreed to in writing, software
11+
# distributed under the License is distributed on an "AS IS" BASIS,
12+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
# See the License for the specific language governing permissions and
14+
# limitations under the License.
15+
16+
name: "Build and Push Docker Images"
17+
18+
on:
19+
workflow_dispatch:
20+
push:
21+
branches:
22+
- master
23+
- 'dev-*'
24+
tags:
25+
- '*-*.*'
26+
pull_request:
27+
branches:
28+
- master
29+
- 'dev-*'
30+
31+
env:
32+
REGISTRY: ghcr.io
33+
OWNER: ${{ github.repository_owner }}
34+
IMAGE_REPO: flink-docker
35+
36+
jobs:
37+
build_and_push:
38+
runs-on: ubuntu-latest
39+
permissions:
40+
contents: read
41+
packages: write
42+
strategy:
43+
fail-fast: false
44+
matrix:
45+
include:
46+
# Flink 1.20.x
47+
- flink_version: "1.20"
48+
java_version: "8"
49+
dockerfile: "1.20/scala_2.12-java8-ubuntu/Dockerfile"
50+
- flink_version: "1.20"
51+
java_version: "11"
52+
dockerfile: "1.20/scala_2.12-java11-ubuntu/Dockerfile"
53+
- flink_version: "1.20"
54+
java_version: "17"
55+
dockerfile: "1.20/scala_2.12-java17-ubuntu/Dockerfile"
56+
# Flink 2.0.x
57+
- flink_version: "2.0"
58+
java_version: "11"
59+
dockerfile: "2.0/scala_2.12-java11-ubuntu/Dockerfile"
60+
- flink_version: "2.0"
61+
java_version: "17"
62+
dockerfile: "2.0/scala_2.12-java17-ubuntu/Dockerfile"
63+
- flink_version: "2.0"
64+
java_version: "21"
65+
dockerfile: "2.0/scala_2.12-java21-ubuntu/Dockerfile"
66+
# Flink 2.1.x (Latest)
67+
- flink_version: "2.1"
68+
java_version: "11"
69+
dockerfile: "2.1/scala_2.12-java11-ubuntu/Dockerfile"
70+
- flink_version: "2.1"
71+
java_version: "17"
72+
dockerfile: "2.1/scala_2.12-java17-ubuntu/Dockerfile"
73+
- flink_version: "2.1"
74+
java_version: "21"
75+
dockerfile: "2.1/scala_2.12-java21-ubuntu/Dockerfile"
76+
77+
steps:
78+
- name: Check out the repo
79+
uses: actions/checkout@v4
80+
81+
- name: Set up QEMU
82+
uses: docker/setup-qemu-action@v3
83+
84+
- name: Set up Docker Buildx
85+
uses: docker/setup-buildx-action@v3
86+
87+
- name: Log in to the Container registry
88+
uses: docker/login-action@v3
89+
with:
90+
registry: ${{ env.REGISTRY }}
91+
username: ${{ github.actor }}
92+
password: ${{ secrets.GITHUB_TOKEN }}
93+
94+
- name: Determine image tags
95+
id: meta
96+
run: |
97+
FLINK_VERSION="${{ matrix.flink_version }}"
98+
JAVA_VERSION="${{ matrix.java_version }}"
99+
100+
# Read full version from Dockerfile (e.g., 2.1.1)
101+
# Extract from FLINK_TGZ_URL which contains the version
102+
DOCKERFILE_PATH="${{ matrix.dockerfile }}"
103+
FULL_VERSION=$(grep "FLINK_TGZ_URL=" "$DOCKERFILE_PATH" | head -1 | sed -E 's/.*flink-([0-9]+\.[0-9]+\.[0-9]+).*/\1/')
104+
105+
if [ -z "$FULL_VERSION" ]; then
106+
echo "ERROR: Could not extract version from $DOCKERFILE_PATH"
107+
exit 1
108+
fi
109+
110+
echo "full_version=$FULL_VERSION" >> $GITHUB_OUTPUT
111+
112+
# Build base image name
113+
BASE_TAG="${FULL_VERSION}-scala_2.12-java${JAVA_VERSION}"
114+
115+
# Determine tags based on event type
116+
TAGS="${REGISTRY}/${OWNER}/${IMAGE_REPO}:${BASE_TAG}"
117+
118+
# Add branch-specific tags for branch pushes
119+
if [ "${{ github.event_name }}" = "push" ] && [ "${{ github.ref_type }}" = "branch" ]; then
120+
BRANCH_NAME=$(echo "${{ github.ref_name }}" | sed 's/\//-/g')
121+
TAGS="${TAGS},${REGISTRY}/${OWNER}/${IMAGE_REPO}:${BRANCH_NAME}-java${JAVA_VERSION}"
122+
TAGS="${TAGS},${REGISTRY}/${OWNER}/${IMAGE_REPO}:${BRANCH_NAME}-${FLINK_VERSION}-java${JAVA_VERSION}"
123+
fi
124+
125+
# Add git sha tag
126+
SHORT_SHA=$(echo "${{ github.sha }}" | cut -c1-7)
127+
TAGS="${TAGS},${REGISTRY}/${OWNER}/${IMAGE_REPO}:${BASE_TAG}-${SHORT_SHA}"
128+
129+
echo "tags=$TAGS" >> $GITHUB_OUTPUT
130+
echo "Image tags: $TAGS"
131+
132+
- name: Build and push Docker image
133+
uses: docker/build-push-action@v5
134+
with:
135+
context: ${{ matrix.flink_version }}/scala_2.12-java${{ matrix.java_version }}-ubuntu
136+
file: ${{ matrix.dockerfile }}
137+
platforms: linux/amd64,linux/arm64/v8
138+
push: ${{ github.event_name != 'pull_request' }}
139+
tags: ${{ steps.meta.outputs.tags }}
140+
cache-from: type=gha
141+
cache-to: type=gha,mode=max
142+
143+
- name: Summary
144+
if: github.event_name != 'pull_request'
145+
run: |
146+
echo "✅ Successfully built and pushed Flink ${{ steps.meta.outputs.full_version }} with Java ${{ matrix.java_version }}"
147+
echo "Tags:"
148+
echo "${{ steps.meta.outputs.tags }}" | tr ',' '\n' | sed 's/^/ - /'

1.20/scala_2.12-java11-ubuntu/Dockerfile

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,7 @@ RUN set -ex; \
3030
wget -nv -O /usr/local/bin/gosu "https://github.com/tianon/gosu/releases/download/$GOSU_VERSION/gosu-$(dpkg --print-architecture)"; \
3131
wget -nv -O /usr/local/bin/gosu.asc "https://github.com/tianon/gosu/releases/download/$GOSU_VERSION/gosu-$(dpkg --print-architecture).asc"; \
3232
export GNUPGHOME="$(mktemp -d)"; \
33-
for server in ha.pool.sks-keyservers.net $(shuf -e \
34-
hkp://p80.pool.sks-keyservers.net:80 \
33+
for server in hkps://keys.openpgp.org $(shuf -e \
3534
keyserver.ubuntu.com \
3635
hkp://keyserver.ubuntu.com:80 \
3736
pgp.mit.edu) ; do \
@@ -63,8 +62,7 @@ RUN set -ex; \
6362
if [ "$CHECK_GPG" = "true" ]; then \
6463
wget -nv -O flink.tgz.asc "$FLINK_ASC_URL"; \
6564
export GNUPGHOME="$(mktemp -d)"; \
66-
for server in ha.pool.sks-keyservers.net $(shuf -e \
67-
hkp://p80.pool.sks-keyservers.net:80 \
65+
for server in hkps://keys.openpgp.org $(shuf -e \
6866
keyserver.ubuntu.com \
6967
hkp://keyserver.ubuntu.com:80 \
7068
pgp.mit.edu) ; do \

1.20/scala_2.12-java17-ubuntu/Dockerfile

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,7 @@ RUN set -ex; \
3030
wget -nv -O /usr/local/bin/gosu "https://github.com/tianon/gosu/releases/download/$GOSU_VERSION/gosu-$(dpkg --print-architecture)"; \
3131
wget -nv -O /usr/local/bin/gosu.asc "https://github.com/tianon/gosu/releases/download/$GOSU_VERSION/gosu-$(dpkg --print-architecture).asc"; \
3232
export GNUPGHOME="$(mktemp -d)"; \
33-
for server in ha.pool.sks-keyservers.net $(shuf -e \
34-
hkp://p80.pool.sks-keyservers.net:80 \
33+
for server in hkps://keys.openpgp.org $(shuf -e \
3534
keyserver.ubuntu.com \
3635
hkp://keyserver.ubuntu.com:80 \
3736
pgp.mit.edu) ; do \
@@ -63,8 +62,7 @@ RUN set -ex; \
6362
if [ "$CHECK_GPG" = "true" ]; then \
6463
wget -nv -O flink.tgz.asc "$FLINK_ASC_URL"; \
6564
export GNUPGHOME="$(mktemp -d)"; \
66-
for server in ha.pool.sks-keyservers.net $(shuf -e \
67-
hkp://p80.pool.sks-keyservers.net:80 \
65+
for server in hkps://keys.openpgp.org $(shuf -e \
6866
keyserver.ubuntu.com \
6967
hkp://keyserver.ubuntu.com:80 \
7068
pgp.mit.edu) ; do \

1.20/scala_2.12-java8-ubuntu/Dockerfile

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,7 @@ RUN set -ex; \
3030
wget -nv -O /usr/local/bin/gosu "https://github.com/tianon/gosu/releases/download/$GOSU_VERSION/gosu-$(dpkg --print-architecture)"; \
3131
wget -nv -O /usr/local/bin/gosu.asc "https://github.com/tianon/gosu/releases/download/$GOSU_VERSION/gosu-$(dpkg --print-architecture).asc"; \
3232
export GNUPGHOME="$(mktemp -d)"; \
33-
for server in ha.pool.sks-keyservers.net $(shuf -e \
34-
hkp://p80.pool.sks-keyservers.net:80 \
33+
for server in hkps://keys.openpgp.org $(shuf -e \
3534
keyserver.ubuntu.com \
3635
hkp://keyserver.ubuntu.com:80 \
3736
pgp.mit.edu) ; do \
@@ -63,8 +62,7 @@ RUN set -ex; \
6362
if [ "$CHECK_GPG" = "true" ]; then \
6463
wget -nv -O flink.tgz.asc "$FLINK_ASC_URL"; \
6564
export GNUPGHOME="$(mktemp -d)"; \
66-
for server in ha.pool.sks-keyservers.net $(shuf -e \
67-
hkp://p80.pool.sks-keyservers.net:80 \
65+
for server in hkps://keys.openpgp.org $(shuf -e \
6866
keyserver.ubuntu.com \
6967
hkp://keyserver.ubuntu.com:80 \
7068
pgp.mit.edu) ; do \

2.0/scala_2.12-java11-ubuntu/Dockerfile

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,7 @@ RUN set -ex; \
3030
wget -nv -O /usr/local/bin/gosu "https://github.com/tianon/gosu/releases/download/$GOSU_VERSION/gosu-$(dpkg --print-architecture)"; \
3131
wget -nv -O /usr/local/bin/gosu.asc "https://github.com/tianon/gosu/releases/download/$GOSU_VERSION/gosu-$(dpkg --print-architecture).asc"; \
3232
export GNUPGHOME="$(mktemp -d)"; \
33-
for server in ha.pool.sks-keyservers.net $(shuf -e \
34-
hkp://p80.pool.sks-keyservers.net:80 \
33+
for server in hkps://keys.openpgp.org $(shuf -e \
3534
keyserver.ubuntu.com \
3635
hkp://keyserver.ubuntu.com:80 \
3736
pgp.mit.edu) ; do \
@@ -63,8 +62,7 @@ RUN set -ex; \
6362
if [ "$CHECK_GPG" = "true" ]; then \
6463
wget -nv -O flink.tgz.asc "$FLINK_ASC_URL"; \
6564
export GNUPGHOME="$(mktemp -d)"; \
66-
for server in ha.pool.sks-keyservers.net $(shuf -e \
67-
hkp://p80.pool.sks-keyservers.net:80 \
65+
for server in hkps://keys.openpgp.org $(shuf -e \
6866
keyserver.ubuntu.com \
6967
hkp://keyserver.ubuntu.com:80 \
7068
pgp.mit.edu) ; do \

2.0/scala_2.12-java17-ubuntu/Dockerfile

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,7 @@ RUN set -ex; \
3030
wget -nv -O /usr/local/bin/gosu "https://github.com/tianon/gosu/releases/download/$GOSU_VERSION/gosu-$(dpkg --print-architecture)"; \
3131
wget -nv -O /usr/local/bin/gosu.asc "https://github.com/tianon/gosu/releases/download/$GOSU_VERSION/gosu-$(dpkg --print-architecture).asc"; \
3232
export GNUPGHOME="$(mktemp -d)"; \
33-
for server in ha.pool.sks-keyservers.net $(shuf -e \
34-
hkp://p80.pool.sks-keyservers.net:80 \
33+
for server in hkps://keys.openpgp.org $(shuf -e \
3534
keyserver.ubuntu.com \
3635
hkp://keyserver.ubuntu.com:80 \
3736
pgp.mit.edu) ; do \
@@ -63,8 +62,7 @@ RUN set -ex; \
6362
if [ "$CHECK_GPG" = "true" ]; then \
6463
wget -nv -O flink.tgz.asc "$FLINK_ASC_URL"; \
6564
export GNUPGHOME="$(mktemp -d)"; \
66-
for server in ha.pool.sks-keyservers.net $(shuf -e \
67-
hkp://p80.pool.sks-keyservers.net:80 \
65+
for server in hkps://keys.openpgp.org $(shuf -e \
6866
keyserver.ubuntu.com \
6967
hkp://keyserver.ubuntu.com:80 \
7068
pgp.mit.edu) ; do \

2.0/scala_2.12-java21-ubuntu/Dockerfile

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,7 @@ RUN set -ex; \
3030
wget -nv -O /usr/local/bin/gosu "https://github.com/tianon/gosu/releases/download/$GOSU_VERSION/gosu-$(dpkg --print-architecture)"; \
3131
wget -nv -O /usr/local/bin/gosu.asc "https://github.com/tianon/gosu/releases/download/$GOSU_VERSION/gosu-$(dpkg --print-architecture).asc"; \
3232
export GNUPGHOME="$(mktemp -d)"; \
33-
for server in ha.pool.sks-keyservers.net $(shuf -e \
34-
hkp://p80.pool.sks-keyservers.net:80 \
33+
for server in hkps://keys.openpgp.org $(shuf -e \
3534
keyserver.ubuntu.com \
3635
hkp://keyserver.ubuntu.com:80 \
3736
pgp.mit.edu) ; do \
@@ -63,8 +62,7 @@ RUN set -ex; \
6362
if [ "$CHECK_GPG" = "true" ]; then \
6463
wget -nv -O flink.tgz.asc "$FLINK_ASC_URL"; \
6564
export GNUPGHOME="$(mktemp -d)"; \
66-
for server in ha.pool.sks-keyservers.net $(shuf -e \
67-
hkp://p80.pool.sks-keyservers.net:80 \
65+
for server in hkps://keys.openpgp.org $(shuf -e \
6866
keyserver.ubuntu.com \
6967
hkp://keyserver.ubuntu.com:80 \
7068
pgp.mit.edu) ; do \

2.1/scala_2.12-java11-ubuntu/Dockerfile

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,7 @@ RUN set -ex; \
3030
wget -nv -O /usr/local/bin/gosu "https://github.com/tianon/gosu/releases/download/$GOSU_VERSION/gosu-$(dpkg --print-architecture)"; \
3131
wget -nv -O /usr/local/bin/gosu.asc "https://github.com/tianon/gosu/releases/download/$GOSU_VERSION/gosu-$(dpkg --print-architecture).asc"; \
3232
export GNUPGHOME="$(mktemp -d)"; \
33-
for server in ha.pool.sks-keyservers.net $(shuf -e \
34-
hkp://p80.pool.sks-keyservers.net:80 \
33+
for server in hkps://keys.openpgp.org $(shuf -e \
3534
keyserver.ubuntu.com \
3635
hkp://keyserver.ubuntu.com:80 \
3736
pgp.mit.edu) ; do \
@@ -63,8 +62,7 @@ RUN set -ex; \
6362
if [ "$CHECK_GPG" = "true" ]; then \
6463
wget -nv -O flink.tgz.asc "$FLINK_ASC_URL"; \
6564
export GNUPGHOME="$(mktemp -d)"; \
66-
for server in ha.pool.sks-keyservers.net $(shuf -e \
67-
hkp://p80.pool.sks-keyservers.net:80 \
65+
for server in hkps://keys.openpgp.org $(shuf -e \
6866
keyserver.ubuntu.com \
6967
hkp://keyserver.ubuntu.com:80 \
7068
pgp.mit.edu) ; do \

2.1/scala_2.12-java17-ubuntu/Dockerfile

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,7 @@ RUN set -ex; \
3030
wget -nv -O /usr/local/bin/gosu "https://github.com/tianon/gosu/releases/download/$GOSU_VERSION/gosu-$(dpkg --print-architecture)"; \
3131
wget -nv -O /usr/local/bin/gosu.asc "https://github.com/tianon/gosu/releases/download/$GOSU_VERSION/gosu-$(dpkg --print-architecture).asc"; \
3232
export GNUPGHOME="$(mktemp -d)"; \
33-
for server in ha.pool.sks-keyservers.net $(shuf -e \
34-
hkp://p80.pool.sks-keyservers.net:80 \
33+
for server in hkps://keys.openpgp.org $(shuf -e \
3534
keyserver.ubuntu.com \
3635
hkp://keyserver.ubuntu.com:80 \
3736
pgp.mit.edu) ; do \
@@ -63,8 +62,7 @@ RUN set -ex; \
6362
if [ "$CHECK_GPG" = "true" ]; then \
6463
wget -nv -O flink.tgz.asc "$FLINK_ASC_URL"; \
6564
export GNUPGHOME="$(mktemp -d)"; \
66-
for server in ha.pool.sks-keyservers.net $(shuf -e \
67-
hkp://p80.pool.sks-keyservers.net:80 \
65+
for server in hkps://keys.openpgp.org $(shuf -e \
6866
keyserver.ubuntu.com \
6967
hkp://keyserver.ubuntu.com:80 \
7068
pgp.mit.edu) ; do \

2.1/scala_2.12-java21-ubuntu/Dockerfile

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,7 @@ RUN set -ex; \
3030
wget -nv -O /usr/local/bin/gosu "https://github.com/tianon/gosu/releases/download/$GOSU_VERSION/gosu-$(dpkg --print-architecture)"; \
3131
wget -nv -O /usr/local/bin/gosu.asc "https://github.com/tianon/gosu/releases/download/$GOSU_VERSION/gosu-$(dpkg --print-architecture).asc"; \
3232
export GNUPGHOME="$(mktemp -d)"; \
33-
for server in ha.pool.sks-keyservers.net $(shuf -e \
34-
hkp://p80.pool.sks-keyservers.net:80 \
33+
for server in hkps://keys.openpgp.org $(shuf -e \
3534
keyserver.ubuntu.com \
3635
hkp://keyserver.ubuntu.com:80 \
3736
pgp.mit.edu) ; do \
@@ -63,8 +62,7 @@ RUN set -ex; \
6362
if [ "$CHECK_GPG" = "true" ]; then \
6463
wget -nv -O flink.tgz.asc "$FLINK_ASC_URL"; \
6564
export GNUPGHOME="$(mktemp -d)"; \
66-
for server in ha.pool.sks-keyservers.net $(shuf -e \
67-
hkp://p80.pool.sks-keyservers.net:80 \
65+
for server in hkps://keys.openpgp.org $(shuf -e \
6866
keyserver.ubuntu.com \
6967
hkp://keyserver.ubuntu.com:80 \
7068
pgp.mit.edu) ; do \

0 commit comments

Comments
 (0)