docker: Add Dockerfile for multi-platforms.
This commit is contained in:
109
.github/workflows/build-nightly-cron.yaml
vendored
109
.github/workflows/build-nightly-cron.yaml
vendored
@@ -292,6 +292,7 @@ jobs:
|
||||
outputs:
|
||||
SPT_SERVER_COMMIT_TIME: ${{ steps.merge.outputs.SPT_SERVER_COMMIT_TIME }}
|
||||
LINUX_COMMIT_ID: ${{ steps.debug-info.outputs.COMMIT_ID }}
|
||||
LINUX_COMMIT_ID_WHOLE: ${{ steps.debug-info.outputs.COMMIT_ID_WHOLE }}
|
||||
LINUX_ARTIFACT: ${{ steps.filename.outputs.LINUX_ARTIFACT }}
|
||||
LINUX_RELEASE_FILE: ${{ steps.filename.outputs.LINUX_RELEASE }}
|
||||
LINUX_RELEASE_FIKA_FILE: ${{ steps.filename.outputs.LINUX_RELEASE_FIKA }}
|
||||
@@ -409,8 +410,9 @@ jobs:
|
||||
- name: Compress fika-server to docker dir
|
||||
run: |
|
||||
cd fika
|
||||
tar -czf ${{ env.SOURCECODE_DIR }}/docker/fika-server.tgz .
|
||||
ls -l ${{ env.SOURCECODE_DIR }}/docker
|
||||
tar -czf ${{ env.SOURCECODE_DIR }}/docker/FikaBuiltIn/fika-server.tgz .
|
||||
cp ${{ env.SOURCECODE_DIR }}/docker/spt-server.tgz ${{ env.SOURCECODE_DIR }}/docker/FikaBuiltIn
|
||||
ls -l ${{ env.SOURCECODE_DIR }}/docker/FikaBuiltIn
|
||||
shell: bash
|
||||
|
||||
- name: Extract metadata for Docker
|
||||
@@ -472,21 +474,20 @@ jobs:
|
||||
org.opencontainers.image.source=https://github.com/AirryCo/spt-server
|
||||
org.opencontainers.image.url=https://github.com/AirryCo/spt-server
|
||||
org.opencontainers.image.revision=${{ steps.debug-info.outputs.COMMIT_ID_WHOLE }}
|
||||
platforms: linux/amd64,linux/arm64
|
||||
platforms: linux/amd64
|
||||
- name: Build and Push with Fika Server
|
||||
id: build-and-push-with-fika
|
||||
uses: docker/build-push-action@v6
|
||||
with:
|
||||
context: ${{ env.SOURCECODE_DIR }}/docker
|
||||
file: ${{ env.SOURCECODE_DIR }}/docker/Dockerfile-fika
|
||||
context: ${{ env.SOURCECODE_DIR }}/docker/FikaBuiltIn
|
||||
push: true
|
||||
tags: ${{ steps.meta-fika.outputs.tags }}
|
||||
labels: |
|
||||
${{ steps.meta.outputs.labels }}
|
||||
${{ steps.meta-fika.outputs.labels }}
|
||||
org.opencontainers.image.source=https://github.com/AirryCo/spt-server
|
||||
org.opencontainers.image.url=https://github.com/AirryCo/spt-server
|
||||
org.opencontainers.image.revision=${{ steps.debug-info.outputs.COMMIT_ID_WHOLE }}
|
||||
platforms: linux/amd64,linux/arm64
|
||||
platforms: linux/amd64
|
||||
|
||||
- name: Push Linux Server Code
|
||||
run: |
|
||||
@@ -497,8 +498,98 @@ jobs:
|
||||
git push
|
||||
shell: bash
|
||||
|
||||
build-docker-image-multi-arch:
|
||||
needs: [prepare, build-server-linux]
|
||||
if: needs.prepare.outputs.PROCEED == 'true' || needs.prepare.outputs.PROCEED_FIKA == 'true'
|
||||
runs-on: ubuntu-latest
|
||||
env:
|
||||
DOCKERHUB_USER: stblog
|
||||
DOCKERHUB_REPOSITORY: spt-server
|
||||
GHCR_USER: airryco
|
||||
GHCR_REPOSITORY: spt-server
|
||||
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v4
|
||||
|
||||
# docker
|
||||
- name: Extract metadata for Docker
|
||||
id: meta
|
||||
uses: docker/metadata-action@v5
|
||||
with:
|
||||
images: |
|
||||
${{ env.DOCKERHUB_USER }}/${{ env.DOCKERHUB_REPOSITORY }}
|
||||
ghcr.io/${{ env.GHCR_USER }}/${{ env.GHCR_REPOSITORY }}
|
||||
registry.cn-shenzhen.aliyuncs.com/spt-server/spt-server
|
||||
tags: |
|
||||
type=raw,value=nightly
|
||||
- name: Extract metadata for Docker with Fika-Server
|
||||
id: meta-fika
|
||||
uses: docker/metadata-action@v5
|
||||
with:
|
||||
images: |
|
||||
${{ env.DOCKERHUB_USER }}/${{ env.DOCKERHUB_REPOSITORY }}
|
||||
ghcr.io/${{ env.GHCR_USER }}/${{ env.GHCR_REPOSITORY }}
|
||||
registry.cn-shenzhen.aliyuncs.com/spt-server/spt-server
|
||||
tags: |
|
||||
type=raw,value=nightly-fika
|
||||
|
||||
- name: Set up QEMU
|
||||
uses: docker/setup-qemu-action@v3
|
||||
- name: Set up Docker Buildx
|
||||
uses: docker/setup-buildx-action@v3
|
||||
|
||||
# DockerHub
|
||||
- name: Login to Dockerhub
|
||||
uses: docker/login-action@v3
|
||||
with:
|
||||
username: ${{ env.DOCKERHUB_USER }}
|
||||
password: ${{ secrets.DOCKERHUB_TOKEN }}
|
||||
# GitHub Container Registry
|
||||
- name: Login to Github Container Registry
|
||||
uses: docker/login-action@v3
|
||||
with:
|
||||
registry: ghcr.io
|
||||
username: ${{ env.GHCR_USER }}
|
||||
password: ${{ secrets.GHCR_TOKEN }}
|
||||
# Aliyun Registry
|
||||
- name: Login to Aliyun Registry
|
||||
uses: docker/login-action@v3
|
||||
with:
|
||||
registry: registry.cn-shenzhen.aliyuncs.com
|
||||
username: ${{ secrets.ALIYUN_REGISTRY_USER }}
|
||||
password: ${{ secrets.ALIYUN_REGISTRY_TOKEN }}
|
||||
|
||||
- name: Build and Push
|
||||
id: build-and-push
|
||||
uses: docker/build-push-action@v6
|
||||
with:
|
||||
context: ./docker
|
||||
push: true
|
||||
tags: ${{ steps.meta.outputs.tags }}
|
||||
labels: |
|
||||
${{ steps.meta.outputs.labels }}
|
||||
org.opencontainers.image.source=https://github.com/AirryCo/spt-server
|
||||
org.opencontainers.image.url=https://github.com/AirryCo/spt-server
|
||||
org.opencontainers.image.revision=${{ needs.build-server-linux.outputs.LINUX_COMMIT_ID_WHOLE }}
|
||||
platforms: linux/arm64
|
||||
- name: Build and Push with Fika Server
|
||||
id: build-and-push-with-fika
|
||||
uses: docker/build-push-action@v6
|
||||
with:
|
||||
context: ./docker
|
||||
file: ./docker/Dockerfile-fika
|
||||
push: true
|
||||
tags: ${{ steps.meta-fika.outputs.tags }}
|
||||
labels: |
|
||||
${{ steps.meta-fika.outputs.labels }}
|
||||
org.opencontainers.image.source=https://github.com/AirryCo/spt-server
|
||||
org.opencontainers.image.url=https://github.com/AirryCo/spt-server
|
||||
org.opencontainers.image.revision=${{ needs.build-server-linux.outputs.LINUX_COMMIT_ID_WHOLE }}
|
||||
platforms: linux/arm64
|
||||
|
||||
update-trigger-and-push:
|
||||
needs: [prepare, build-server-windows, build-server-linux]
|
||||
needs: [prepare, build-server-windows, build-docker-image-multi-arch]
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Checkout
|
||||
@@ -528,8 +619,6 @@ jobs:
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
fetch-depth: 0
|
||||
|
||||
- name: Download Windows Artifact
|
||||
uses: actions/download-artifact@v4
|
||||
|
||||
104
.github/workflows/build-release-cron.yaml
vendored
104
.github/workflows/build-release-cron.yaml
vendored
@@ -208,6 +208,7 @@ jobs:
|
||||
GHCR_REPOSITORY: spt-server
|
||||
outputs:
|
||||
LINUX_COMMIT_ID: ${{ steps.debug-info.outputs.COMMIT_ID }}
|
||||
LINUX_COMMIT_ID_WHOLE: ${{ steps.debug-info.outputs.COMMIT_ID_WHOLE }}
|
||||
LINUX_ARTIFACT: ${{ steps.filename.outputs.LINUX_ARTIFACT }}
|
||||
LINUX_RELEASE_FILE: ${{ steps.filename.outputs.LINUX_RELEASE }}
|
||||
|
||||
@@ -370,8 +371,7 @@ jobs:
|
||||
org.opencontainers.image.source=https://github.com/AirryCo/spt-server
|
||||
org.opencontainers.image.url=https://github.com/AirryCo/spt-server
|
||||
org.opencontainers.image.revision=${{ steps.debug-info.outputs.COMMIT_ID_WHOLE }}
|
||||
platforms: linux/amd64,linux/arm64
|
||||
|
||||
platforms: linux/amd64
|
||||
- name: Build and Push For Latest
|
||||
if: ${{ !contains(needs.prepare.outputs.TARGET_TAG, 'BEM') }}
|
||||
uses: docker/build-push-action@v6
|
||||
@@ -384,7 +384,7 @@ jobs:
|
||||
org.opencontainers.image.source=https://github.com/AirryCo/spt-server
|
||||
org.opencontainers.image.url=https://github.com/AirryCo/spt-server
|
||||
org.opencontainers.image.revision=${{ steps.debug-info.outputs.COMMIT_ID_WHOLE }}
|
||||
platforms: linux/amd64,linux/arm64
|
||||
platforms: linux/amd64
|
||||
|
||||
- name: Push Linux Server Code And Tag
|
||||
run: |
|
||||
@@ -399,8 +399,104 @@ jobs:
|
||||
git push -u origin ${{ needs.prepare.outputs.TARGET_TAG }}
|
||||
shell: bash
|
||||
|
||||
build-docker-image-multi-arch:
|
||||
needs: [prepare, build-server-linux]
|
||||
if: needs.prepare.outputs.PROCEED == 'true' || needs.prepare.outputs.PROCEED_FIKA == 'true'
|
||||
runs-on: ubuntu-latest
|
||||
env:
|
||||
DOCKERHUB_USER: stblog
|
||||
DOCKERHUB_REPOSITORY: spt-server
|
||||
GHCR_USER: airryco
|
||||
GHCR_REPOSITORY: spt-server
|
||||
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v4
|
||||
|
||||
# docker
|
||||
- name: Extract metadata for Docker with bem version
|
||||
if: ${{ contains(needs.prepare.outputs.TARGET_TAG, 'BEM') }}
|
||||
id: meta
|
||||
uses: docker/metadata-action@v5
|
||||
with:
|
||||
images: |
|
||||
${{ env.DOCKERHUB_USER }}/${{ env.DOCKERHUB_REPOSITORY }}
|
||||
ghcr.io/${{ env.GHCR_USER }}/${{ env.GHCR_REPOSITORY }}
|
||||
registry.cn-shenzhen.aliyuncs.com/spt-server/spt-server
|
||||
tags: |
|
||||
type=semver,pattern={{version}},value=${{ needs.prepare.outputs.TARGET_TAG }}
|
||||
type=semver,pattern={{major}}.{{minor}},value=${{ needs.prepare.outputs.TARGET_TAG }}
|
||||
- name: Extract metadata for Docker with latest version
|
||||
if: ${{ !contains(needs.prepare.outputs.TARGET_TAG, 'BEM') }}
|
||||
id: meta-latest
|
||||
uses: docker/metadata-action@v5
|
||||
with:
|
||||
images: |
|
||||
${{ env.DOCKERHUB_USER }}/${{ env.DOCKERHUB_REPOSITORY }}
|
||||
ghcr.io/${{ env.GHCR_USER }}/${{ env.GHCR_REPOSITORY }}
|
||||
registry.cn-shenzhen.aliyuncs.com/spt-server/spt-server
|
||||
tags: |
|
||||
type=semver,pattern={{version}},value=${{ needs.prepare.outputs.TARGET_TAG }}
|
||||
type=semver,pattern={{major}}.{{minor}},value=${{ needs.prepare.outputs.TARGET_TAG }}
|
||||
type=raw,value=latest
|
||||
|
||||
- name: Set up QEMU
|
||||
uses: docker/setup-qemu-action@v3
|
||||
- name: Set up Docker Buildx
|
||||
uses: docker/setup-buildx-action@v3
|
||||
|
||||
# DockerHub
|
||||
- name: Login to Dockerhub
|
||||
uses: docker/login-action@v3
|
||||
with:
|
||||
username: ${{ env.DOCKERHUB_USER }}
|
||||
password: ${{ secrets.DOCKERHUB_TOKEN }}
|
||||
# GitHub Container Registry
|
||||
- name: Login to Github Container Registry
|
||||
uses: docker/login-action@v3
|
||||
with:
|
||||
registry: ghcr.io
|
||||
username: ${{ env.GHCR_USER }}
|
||||
password: ${{ secrets.GHCR_TOKEN }}
|
||||
# Aliyun Registry
|
||||
- name: Login to Aliyun Registry
|
||||
uses: docker/login-action@v3
|
||||
with:
|
||||
registry: registry.cn-shenzhen.aliyuncs.com
|
||||
username: ${{ secrets.ALIYUN_REGISTRY_USER }}
|
||||
password: ${{ secrets.ALIYUN_REGISTRY_TOKEN }}
|
||||
|
||||
- name: Build and Push For BEM
|
||||
if: ${{ contains(needs.prepare.outputs.TARGET_TAG, 'BEM') }}
|
||||
id: build-and-push
|
||||
uses: docker/build-push-action@v6
|
||||
with:
|
||||
context: ./docker
|
||||
push: true
|
||||
tags: ${{ steps.meta.outputs.tags }}
|
||||
labels: |
|
||||
${{ steps.meta.outputs.labels }}
|
||||
org.opencontainers.image.source=https://github.com/AirryCo/spt-server
|
||||
org.opencontainers.image.url=https://github.com/AirryCo/spt-server
|
||||
org.opencontainers.image.revision=${{ needs.build-server-linux.outputs.LINUX_COMMIT_ID_WHOLE }}
|
||||
platforms: linux/arm64
|
||||
- name: Build and Push For Latest
|
||||
if: ${{ !contains(needs.prepare.outputs.TARGET_TAG, 'BEM') }}
|
||||
id: build-and-push
|
||||
uses: docker/build-push-action@v6
|
||||
with:
|
||||
context: ./docker
|
||||
push: true
|
||||
tags: ${{ steps.meta.outputs.tags }}
|
||||
labels: |
|
||||
${{ steps.meta.outputs.labels }}
|
||||
org.opencontainers.image.source=https://github.com/AirryCo/spt-server
|
||||
org.opencontainers.image.url=https://github.com/AirryCo/spt-server
|
||||
org.opencontainers.image.revision=${{ needs.build-server-linux.outputs.LINUX_COMMIT_ID_WHOLE }}
|
||||
platforms: linux/arm64
|
||||
|
||||
assemble-and-publish:
|
||||
needs: [prepare, build-server-windows, build-server-linux]
|
||||
needs: [prepare, build-server-windows, build-server-linux, build-docker-image-multi-arch]
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
steps:
|
||||
|
||||
Reference in New Issue
Block a user