Skip to content

Commit

Permalink
[Feature][Auto Build] support docs&docker CI (DataLinkDC#1480)
Browse files Browse the repository at this point in the history
* change file path

* action test

* add github action(auto build Dockerfile image)

* add github action(auto build Dockerfile image)

* add github action(auto build Dockerfile image)

* add github action(auto build Dockerfile image)

* add github action(auto build Dockerfile image)

* add github action(auto build Dockerfile image)

* add github action(auto build Dockerfile image)

* add github action(auto build Dockerfile image)

* add github action(auto build Dockerfile image)

* add github action(auto build Dockerfile image)

* add github action(auto build Dockerfile image)

* add github action(auto build Dockerfile image)

* add github action(auto build Dockerfile image)

* add github action(auto build Dockerfile image)

* add github action(auto build Dockerfile image)

* add github action(auto build Dockerfile image)

* add github action(auto build Dockerfile image)

* add github action(auto build Dockerfile image)

* add github action(auto build Dockerfile image)

* add github action(auto build Dockerfile image)

* add github action(auto build Dockerfile image)

* add github action(auto build Dockerfile image)

* add github action(auto build docs)

* add github action(auto build docs)

* add github action(auto build docs)

* add github action(auto build docs)

* add github action(auto build docs)

* add github action(auto build docs)

* add github action(auto build docs)

* add github action(auto build docs)

* add github action(auto build docs)
  • Loading branch information
zackyoungh authored Dec 28, 2022
1 parent 245f3b3 commit 2ee8893
Show file tree
Hide file tree
Showing 6 changed files with 303 additions and 2 deletions.
213 changes: 213 additions & 0 deletions .github/workflows/docker_build.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,213 @@
#
# 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

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 \
-Dcheckstyle.skip=true \
-Dspotless.check.skip=true \
-P prod,scala-2.12,all,web,maven-central,fast \
--no-snapshot-updates
- name: Upload release file
uses: actions/upload-artifact@v3
with:
name: release-file
path: ./build/dlink-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: dinky
- url: docker.io
namespace: dinkydocker
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: 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 ]
# FLINK_VERSION: [1.11.6 , 1.12.7 , 1.13.6 , 1.14.6 , 1.15.2 , 1.16.0]
include:
- url: registry.cn-hangzhou.aliyuncs.com
namespace: dinky
- url: docker.io
namespace: dinkydocker
steps:
- uses: actions/checkout@v3
- 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.11.6 , 1.12.7 , 1.13.6 , 1.14.6 , 1.15.2 , 1.16.0]
include:
- url: registry.cn-hangzhou.aliyuncs.com
namespace: dinky
- url: docker.io
namespace: dinkydocker
- FLINK_VERSION: 1.11.6
FLINK_BIG_VERSION: 1.11
FLINK_SINGLE_VERSION: 11
- FLINK_VERSION: 1.12.7
FLINK_BIG_VERSION: 1.12
FLINK_SINGLE_VERSION: 12
- FLINK_VERSION: 1.13.6
FLINK_BIG_VERSION: 1.13
FLINK_SINGLE_VERSION: 13
- FLINK_VERSION: 1.14.6
FLINK_BIG_VERSION: 1.14
FLINK_SINGLE_VERSION: 14
- FLINK_VERSION: 1.15.2
FLINK_BIG_VERSION: 1.15
FLINK_SINGLE_VERSION: 15
- FLINK_VERSION: 1.16.0
FLINK_BIG_VERSION: 1.16
FLINK_SINGLE_VERSION: 16
steps:
- 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: DockerfileDinkyFlink
context: .
push: true
tags: ${{ matrix.url }}/${{ matrix.namespace }}/dinky-standalone-server:${{ inputs.version }}-flink${{ matrix.FLINK_SINGLE_VERSION }}
40 changes: 40 additions & 0 deletions .github/workflows/docs.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
# 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: "Build documentation"
on:
schedule:
- cron: '0 0 * * *' # Deploy every day
workflow_dispatch:

jobs:
build-documentation:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Build documentation
run: |
cd docs && npm install --prefer-offline --no-audit --progress=false --legacy-peer-deps \
&& npm run build
- name: Upload documentation
uses: burnett01/rsync-deployments@5.2
with:
switches: --archive --compress --delete-before
path: docs/build/
remote_path: /root/test
remote_host: ${{ secrets.RSYNC_HOST }}
remote_port: ${{ secrets.RSYNC_PORT }}
remote_user: ${{ secrets.RSYNC_USER }}
remote_key: ${{ secrets.RSYNC_KEY }}
19 changes: 19 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
FROM ibmjava:8-sfj as build-stage

ARG DINKY_VERSION
ENV DINKY_VERSION=${DINKY_VERSION}

ADD ./build/dlink-release-${DINKY_VERSION}.tar.gz /opt/

USER root
RUN mv /opt/dlink-release-${DINKY_VERSION} /opt/dinky/
RUN mkdir -p /opt/dinky/run && mkdir -p /opt/dinky/logs && touch /opt/dinky/logs/dlink.log
RUN chmod -R 777 /opt/dinky/

FROM ibmjava:8-sfj as production-stage
COPY --from=build-stage /opt/dinky/ /opt/dinky/
WORKDIR /opt/dinky/

EXPOSE 8888

CMD ./auto.sh restart && tail -f /opt/dinky/logs/dlink.log
21 changes: 21 additions & 0 deletions DockerfileDinkyFlink
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
ARG FLINK_VERSION
ARG DINKY_IMAGE

FROM flink:${FLINK_VERSION} as reqired-stage

FROM ${DINKY_IMAGE} as build-stage

FROM ibmjava:8-sfj as production-stage

USER root
ARG FLINK_BIG_VERSION

ENV FLINK_BIG_VERSION=${FLINK_BIG_VERSION}

COPY --from=build-stage /opt/dinky/ /opt/dinky/
COPY --from=reqired-stage /opt/flink/lib/*.jar /opt/dinky/plugins/flink${FLINK_BIG_VERSION}
WORKDIR /opt/dinky/

EXPOSE 8888

CMD ./auto.sh restart && tail -f /opt/dinky/logs/dlink.log
8 changes: 8 additions & 0 deletions DockerfileMysql
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
FROM mysql:5.7 as production-stage

ENV MYSQL_ROOT_PASSWORD=dlink
ENV MYSQL_DATABASE=dlink
ENV MYSQL_USER=dlink
ENV MYSQL_PASSWORD=dlink

COPY ./dlink-doc/sql/dinky.sql /docker-entrypoint-initdb.d/01-dinky.sql
4 changes: 2 additions & 2 deletions check_package_size.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ total_text=$(ls -ls | grep total)
total_size=${total_text/'total '/''}
echo `ls -lh`

if [[ ${total_size} -gt 204800 ]]; then
echo "尺寸为:$total_size大于200mb,编译失败"
if [[ ${total_size} -gt 256000 ]]; then
echo "尺寸为:$total_size大于250mb,编译失败"
exit 1
else
exit 0
Expand Down

0 comments on commit 2ee8893

Please sign in to comment.