Docker Build #4
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
# | |
# Licensed to the Apache Software Foundation (ASF) under one or more | |
# contributor license agreements. See the NOTICE file distributed with | |
# this work for additional information regarding copyright ownership. | |
# The ASF licenses this file to You under the Apache License, Version 2.0 | |
# (the "License"); you may not use this file except in compliance with | |
# the License. You may obtain a copy of the License at | |
# | |
# http://www.apache.org/licenses/LICENSE-2.0 | |
# | |
# Unless required by applicable law or agreed to in writing, software | |
# distributed under the License is distributed on an "AS IS" BASIS, | |
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | |
# See the License for the specific language governing permissions and | |
# limitations under the License. | |
# | |
name: Docker Build | |
on: | |
workflow_dispatch: | |
inputs: | |
version: | |
description: 'dinky version' | |
required: true | |
env: | |
ALIYUN_DOCKER_REGISTRY_NAMESPACE: ${{ vars.ALIYUN_DOCKER_NAMESPACE }} | |
DOCKERHUB_REGISTRY_NAMESPACE: ${{ vars.DOCKERHUB_NAMESPACE }} | |
jobs: | |
build_releases: | |
name: build releases | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
# maven编译 | |
- name: Set up JDK 8 | |
uses: actions/setup-java@v2 | |
with: | |
java-version: 8 | |
distribution: 'adopt' | |
- name: Cache local Maven repository | |
uses: actions/cache@v3 | |
with: | |
path: | | |
~/.m2/repository/*/*/* | |
key: ${{ runner.os }}-maven-${{ hashFiles('pom.xml') }} | |
restore-keys: | | |
${{ runner.os }}-maven- | |
# - name: Check Style | |
# run: | | |
# ./mvnw -T 4C -B --no-snapshot-updates clean spotless:check | |
- name: Build and Package | |
run: | | |
./mvnw -B clean install \ | |
-Dmaven.test.skip=true \ | |
-Dspotless.check.skip=true \ | |
-P prod,scala-2.12,flink-all,web,maven-central,fast \ | |
--no-snapshot-updates | |
- name: Upload release file | |
uses: actions/upload-artifact@v3 | |
with: | |
name: release-file | |
path: ./build/dinky-release-*.tar.gz | |
dinky_mysql_image: | |
name: dinky mysql image | |
runs-on: ubuntu-latest | |
strategy: | |
fail-fast: true | |
matrix: | |
url: [ registry.cn-hangzhou.aliyuncs.com ,docker.io ] | |
include: | |
- url: registry.cn-hangzhou.aliyuncs.com | |
namespace: "$ALIYUN_DOCKER_REGISTRY_NAMESPACE" | |
- url: docker.io | |
namespace: "$DOCKERHUB_REGISTRY_NAMESPACE" | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Log in to the Container registry,url -> ${{ matrix.url }} | |
if: ${{ matrix.url == 'registry.cn-hangzhou.aliyuncs.com'}} | |
uses: docker/login-action@v2 | |
with: | |
registry: ${{ matrix.url }} | |
username: ${{ secrets.DOCKER_ALIYUN_USER }} | |
password: ${{ secrets.DOCKER_ALIYUN_PASS }} | |
- name: Log in to the Container registry,url -> ${{ matrix.url }} | |
if: ${{ matrix.url == 'docker.io'}} | |
uses: docker/login-action@v2 | |
with: | |
registry: ${{ matrix.url }} | |
username: ${{ secrets.DOCKER_IO_USER }} | |
password: ${{ secrets.DOCKER_IO_PASS }} | |
- name: push docker dinky mysql image | |
uses: docker/build-push-action@v2 | |
with: | |
file: docker/DockerfileMysql | |
context: . | |
push: true | |
tags: ${{ matrix.url }}/${{ matrix.namespace }}/dinky-mysql-server:${{ inputs.version }} | |
dinky_image: | |
name: docker dinky image | |
runs-on: ubuntu-latest | |
needs: [build_releases] | |
strategy: | |
fail-fast: true | |
matrix: | |
url: [ registry.cn-hangzhou.aliyuncs.com ,docker.io ] | |
include: | |
- url: registry.cn-hangzhou.aliyuncs.com | |
namespace: "$ALIYUN_DOCKER_REGISTRY_NAMESPACE" | |
- url: docker.io | |
namespace: "$DOCKERHUB_REGISTRY_NAMESPACE" | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Move Dockerfile | |
run: | | |
cp ./docker/Dockerfile* ./ | |
- name: Download math result for job 1 | |
uses: actions/download-artifact@v3 | |
with: | |
name: release-file | |
path: ./build/ | |
- name: Log in to the Container registry,url -> ${{ matrix.url }} | |
if: ${{ matrix.url == 'registry.cn-hangzhou.aliyuncs.com'}} | |
uses: docker/login-action@v2 | |
with: | |
registry: ${{ matrix.url }} | |
username: ${{ secrets.DOCKER_ALIYUN_USER }} | |
password: ${{ secrets.DOCKER_ALIYUN_PASS }} | |
- name: Log in to the Container registry,url -> ${{ matrix.url }} | |
if: ${{ matrix.url == 'docker.io'}} | |
uses: docker/login-action@v2 | |
with: | |
registry: ${{ matrix.url }} | |
username: ${{ secrets.DOCKER_IO_USER }} | |
password: ${{ secrets.DOCKER_IO_PASS }} | |
- name: push docker dinky image | |
uses: docker/build-push-action@v2 | |
with: | |
build-args: | | |
DINKY_VERSION=${{ inputs.version }} | |
file: Dockerfile | |
context: . | |
push: true | |
tags: ${{ matrix.url }}/${{ matrix.namespace }}/dinky-standalone-server:${{ inputs.version }} | |
dinky_flink_image: | |
name: docker dinky flink image | |
runs-on: ubuntu-latest | |
needs: [ dinky_image ] | |
strategy: | |
fail-fast: true | |
matrix: | |
url: [ registry.cn-hangzhou.aliyuncs.com ,docker.io ] | |
FLINK_VERSION: [1.14.6 , 1.15.2 , 1.16.0, 1.17.0, 1.18.0] | |
include: | |
- url: registry.cn-hangzhou.aliyuncs.com | |
namespace: dinky | |
- url: docker.io | |
namespace: dinkydocker | |
- FLINK_VERSION: 1.14.6 | |
FLINK_BIG_VERSION: 1.14 | |
- FLINK_VERSION: 1.15.4 | |
FLINK_BIG_VERSION: 1.15 | |
- FLINK_VERSION: 1.16.2 | |
FLINK_BIG_VERSION: 1.16 | |
- FLINK_VERSION : 1.17.1 | |
FLINK_BIG_VERSION: 1.17 | |
- FLINK_VERSION: 1.18.0 | |
FLINK_BIG_VERSION: 1.18 | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Move Dockerfile | |
run: | | |
cp ./docker/Dockerfile* ./ | |
- uses: actions/checkout@v3 | |
- name: set the flink_big_version | |
run: | | |
echo FLINK_BIG_VERSION=${FLINK_VERSION%.*} >> $GITHUB_ENV | |
- name: Download math result for job 1 | |
uses: actions/download-artifact@v3 | |
with: | |
name: release-file | |
path: ./build/ | |
- name: Log in to the Container registry,url -> ${{ matrix.url }} | |
if: ${{ matrix.url == 'registry.cn-hangzhou.aliyuncs.com'}} | |
uses: docker/login-action@v2 | |
with: | |
registry: ${{ matrix.url }} | |
username: ${{ secrets.DOCKER_ALIYUN_USER }} | |
password: ${{ secrets.DOCKER_ALIYUN_PASS }} | |
- name: Log in to the Container registry,url -> ${{ matrix.url }} | |
if: ${{ matrix.url == 'docker.io'}} | |
uses: docker/login-action@v2 | |
with: | |
registry: ${{ matrix.url }} | |
username: ${{ secrets.DOCKER_IO_USER }} | |
password: ${{ secrets.DOCKER_IO_PASS }} | |
- name: push docker dinky image | |
uses: docker/build-push-action@v2 | |
with: | |
build-args: | | |
FLINK_VERSION=${{ matrix.FLINK_VERSION }} | |
DINKY_IMAGE=${{ matrix.url }}/${{ matrix.namespace }}/dinky-standalone-server:${{ inputs.version }} | |
FLINK_BIG_VERSION=${{ matrix.FLINK_BIG_VERSION }} | |
file: ./docker/DockerfileDinkyFlink | |
context: . | |
push: true | |
tags: ${{ matrix.url }}/${{ matrix.namespace }}/dinky-standalone-server:${{ inputs.version }}-flink-${{matrix.FLINK_BIG_VERSION }} |