v2 Test Images #46
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
name: v2 Test Images | |
on: workflow_dispatch | |
jobs: | |
build-amd64: | |
permissions: write-all | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Set up JDK 8 | |
uses: actions/setup-java@v3 | |
with: | |
java-version: '8' | |
distribution: 'temurin' | |
cache: maven | |
- name: Build with Maven | |
run: | | |
mvn -B package --file pom.xml | |
cp target/*.jar . | |
# 设置 QEMU, 后面 docker buildx 依赖此. | |
- name: Set up QEMU | |
uses: docker/setup-qemu-action@v1 | |
# 设置 Docker buildx, 方便构建 Multi platform 镜像 | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v1 | |
# 登录 docker hub | |
- name: Login to DockerHub | |
uses: docker/login-action@v1 | |
with: | |
# GitHub Repo => Settings => Secrets 增加 docker hub 登录密钥信息 | |
# DOCKERHUB_USERNAME 是 docker hub 账号名. | |
# DOCKERHUB_TOKEN: docker hub => Account Setting => Security 创建. | |
username: ${{ secrets.DOCKERHUB_USERNAME }} | |
password: ${{ secrets.DOCKERHUB_PWD }} | |
# 构建 amd64 Docker镜像 | |
- name: Build the amd64 Docker image | |
run: | | |
docker build . --file Dockerfile --tag yajuhua/podcast2:amd64-$(date +test-%Y-%m-%d) --platform linux/amd64 | |
docker push yajuhua/podcast2:amd64-$(date +test-%Y-%m-%d) | |
build-arm64: | |
permissions: write-all | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Set up JDK 8 | |
uses: actions/setup-java@v3 | |
with: | |
java-version: '8' | |
distribution: 'temurin' | |
cache: maven | |
arch: aarch64 | |
- name: Build with Maven | |
run: | | |
mvn -B package --file pom.xml | |
cp target/*.jar . | |
# 设置 QEMU, 后面 docker buildx 依赖此. | |
- name: Set up QEMU | |
uses: docker/setup-qemu-action@v1 | |
# 设置 Docker buildx, 方便构建 Multi platform 镜像 | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v1 | |
# 通过 git 命令获取当前 tag 信息, 存入环境变量 APP_VERSION | |
- name: Generate App Version | |
run: echo "APP_VERSION=$(curl --silent "https://api.github.com/repos/yajuhua/podcast2/releases/latest" | grep '"tag_name":' | sed -E 's/.*"([^"]+)".*/\1/')" >> $GITHUB_ENV | |
# 登录 docker hub | |
- name: Login to DockerHub | |
uses: docker/login-action@v1 | |
with: | |
# GitHub Repo => Settings => Secrets 增加 docker hub 登录密钥信息 | |
# DOCKERHUB_USERNAME 是 docker hub 账号名. | |
# DOCKERHUB_TOKEN: docker hub => Account Setting => Security 创建. | |
username: ${{ secrets.DOCKERHUB_USERNAME }} | |
password: ${{ secrets.DOCKERHUB_PWD }} | |
# 构建 arm32v7 Docker镜像 | |
- name: Build the arm32v7 Docker image | |
run: | | |
docker build . --file Dockerfile --tag yajuhua/podcast2:arm64-$(date +test-%Y-%m-%d) --platform linux/arm64 | |
docker push yajuhua/podcast2:arm64-$(date +test-%Y-%m-%d) | |
build-arm32v7: | |
permissions: write-all | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Set up JDK 8 | |
uses: actions/setup-java@v3 | |
with: | |
java-version: '8' | |
distribution: 'temurin' | |
cache: maven | |
arch: armv7 | |
- name: Build with Maven | |
run: | | |
mvn -B package --file pom.xml | |
cp target/*.jar . | |
# 设置 QEMU, 后面 docker buildx 依赖此. | |
- name: Set up QEMU | |
uses: docker/setup-qemu-action@v1 | |
# 设置 Docker buildx, 方便构建 Multi platform 镜像 | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v1 | |
# 通过 git 命令获取当前 tag 信息, 存入环境变量 APP_VERSION | |
- name: Generate App Version | |
run: echo "APP_VERSION=$(curl --silent "https://api.github.com/repos/yajuhua/podcast2/releases/latest" | grep '"tag_name":' | sed -E 's/.*"([^"]+)".*/\1/')" >> $GITHUB_ENV | |
# 登录 docker hub | |
- name: Login to DockerHub | |
uses: docker/login-action@v1 | |
with: | |
# GitHub Repo => Settings => Secrets 增加 docker hub 登录密钥信息 | |
# DOCKERHUB_USERNAME 是 docker hub 账号名. | |
# DOCKERHUB_TOKEN: docker hub => Account Setting => Security 创建. | |
username: ${{ secrets.DOCKERHUB_USERNAME }} | |
password: ${{ secrets.DOCKERHUB_PWD }} | |
# 构建 amd64 Docker镜像 | |
- name: Build the arm32v7 Docker image | |
run: | | |
docker build . --file Dockerfile --tag yajuhua/podcast2:arm32v7-$(date +test-%Y-%m-%d) --platform linux/arm/v7 | |
docker push yajuhua/podcast2:arm32v7-$(date +test-%Y-%m-%d) | |
push-docker-hub: | |
permissions: write-all | |
runs-on: ubuntu-latest | |
needs: [ build-arm64,build-amd64,build-arm32v7] | |
steps: | |
# 设置 QEMU, 后面 docker buildx 依赖此. | |
- name: Set up QEMU | |
uses: docker/setup-qemu-action@v1 | |
# 设置 Docker buildx, 方便构建 Multi platform 镜像 | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v1 | |
- name: pull amd4 and arm64 docker images | |
run: | | |
docker pull yajuhua/podcast2:arm64-$(date +test-%Y-%m-%d) | |
docker pull yajuhua/podcast2:amd64-$(date +test-%Y-%m-%d) | |
docker pull yajuhua/podcast2:arm32v7-$(date +test-%Y-%m-%d) | |
# 登录 docker hub | |
- name: Login to DockerHub | |
uses: docker/login-action@v1 | |
with: | |
# GitHub Repo => Settings => Secrets 增加 docker hub 登录密钥信息 | |
# DOCKERHUB_USERNAME 是 docker hub 账号名. | |
# DOCKERHUB_TOKEN: docker hub => Account Setting => Security 创建. | |
username: ${{ secrets.DOCKERHUB_USERNAME }} | |
password: ${{ secrets.DOCKERHUB_PWD }} | |
- name: create manifest | |
run: | | |
docker manifest create yajuhua/podcast2:beta-$(date +%Y-%m-%d) yajuhua/podcast2:arm64-$(date +test-%Y-%m-%d) yajuhua/podcast2:amd64-$(date +test-%Y-%m-%d) yajuhua/podcast2:arm32v7-$(date +test-%Y-%m-%d) | |
- name: push manifest | |
run: | | |
docker manifest push yajuhua/podcast2:beta-$(date +%Y-%m-%d) |