mirror of
https://github.com/asdlokj1qpi233/subconverter.git
synced 2026-11-04 10:42:04 +00:00
Update Docker build script
This commit is contained in:
1 file changed
+318
-22
+318
-22
@@ -6,35 +6,40 @@ concurrency:
|
|||||||
cancel-in-progress: true
|
cancel-in-progress: true
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
build:
|
amd64_build:
|
||||||
name: Build
|
name: Build AMD64 Image
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
|
|
||||||
- name: Checkout base
|
- name: Checkout base
|
||||||
uses: actions/checkout@v2
|
uses: actions/checkout@v2
|
||||||
with:
|
with:
|
||||||
fetch-depth: 0
|
fetch-depth: 0
|
||||||
|
|
||||||
# https://github.com/docker/setup-qemu-action
|
|
||||||
- name: Set up QEMU
|
|
||||||
uses: docker/setup-qemu-action@v1
|
|
||||||
# https://github.com/docker/setup-buildx-action
|
|
||||||
- name: Set up Docker Buildx
|
- name: Set up Docker Buildx
|
||||||
uses: docker/setup-buildx-action@v1
|
uses: docker/setup-buildx-action@v2
|
||||||
|
|
||||||
- name: Docker login
|
- name: Get commit SHA
|
||||||
env:
|
id: vars
|
||||||
DOCKER_USERNAME: ${{ secrets.DOCKER_USERNAME }}
|
run: echo "::set-output name=sha_short::$(git rev-parse --short HEAD)"
|
||||||
DOCKER_PASSWORD: ${{ secrets.DOCKER_PASSWORD }}
|
|
||||||
run: |
|
- name: Build and export
|
||||||
echo "${DOCKER_PASSWORD}" | docker login --username "${DOCKER_USERNAME}" --password-stdin
|
|
||||||
|
|
||||||
- name: Docker buildx image and push on master branch
|
|
||||||
if: github.ref == 'refs/heads/master'
|
if: github.ref == 'refs/heads/master'
|
||||||
run: |
|
uses: docker/build-push-action@v3
|
||||||
SHA=$(git rev-parse --short HEAD)
|
with:
|
||||||
docker buildx build --build-arg SHA="$SHA" --build-arg THREADS=1 --output "type=image,push=true" --platform=linux/amd64,linux/arm/v7,linux/arm64,linux/386 --tag tindy2013/subconverter:latest scripts/
|
platforms: linux/amd64
|
||||||
|
context: scripts/
|
||||||
|
tags: tindy2013/subconverter:latest
|
||||||
|
build-args: |
|
||||||
|
SHA=${{ steps.vars.outputs.sha_short }}
|
||||||
|
THREADS=1
|
||||||
|
outputs: type=docker,dest=/tmp/image_amd64.tar
|
||||||
|
|
||||||
|
- name: Upload artifact
|
||||||
|
if: github.ref == 'refs/heads/master'
|
||||||
|
uses: actions/upload-artifact@v3
|
||||||
|
with:
|
||||||
|
name: image_amd64
|
||||||
|
path: /tmp/image_amd64.tar
|
||||||
|
|
||||||
- name: Replace tag without `v`
|
- name: Replace tag without `v`
|
||||||
if: startsWith(github.ref, 'refs/tags/')
|
if: startsWith(github.ref, 'refs/tags/')
|
||||||
@@ -45,8 +50,299 @@ jobs:
|
|||||||
return context.payload.ref.replace(/\/?refs\/tags\/v/, '')
|
return context.payload.ref.replace(/\/?refs\/tags\/v/, '')
|
||||||
result-encoding: string
|
result-encoding: string
|
||||||
|
|
||||||
- name: Docker buildx image and push on release
|
- name: Build release and export
|
||||||
|
if: startsWith(github.ref, 'refs/tags/')
|
||||||
|
uses: docker/build-push-action@v3
|
||||||
|
with:
|
||||||
|
platforms: linux/amd64
|
||||||
|
context: scripts/
|
||||||
|
tags: tindy2013/subconverter:${{steps.version.outputs.result}}
|
||||||
|
build-args: |
|
||||||
|
THREADS=1
|
||||||
|
outputs: type=docker,dest=/tmp/image_amd64_release.tar
|
||||||
|
|
||||||
|
|
||||||
|
- name: Upload release artifact
|
||||||
|
if: startsWith(github.ref, 'refs/tags/')
|
||||||
|
uses: actions/upload-artifact@v3
|
||||||
|
with:
|
||||||
|
name: image_amd64_release
|
||||||
|
path: /tmp/image_amd64_release.tar
|
||||||
|
|
||||||
|
x86_build:
|
||||||
|
name: Build x86 Image
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- name: Checkout base
|
||||||
|
uses: actions/checkout@v2
|
||||||
|
with:
|
||||||
|
fetch-depth: 0
|
||||||
|
|
||||||
|
- name: Set up Docker Buildx
|
||||||
|
uses: docker/setup-buildx-action@v2
|
||||||
|
|
||||||
|
- name: Get commit SHA
|
||||||
|
id: vars
|
||||||
|
run: echo "::set-output name=sha_short::$(git rev-parse --short HEAD)"
|
||||||
|
|
||||||
|
- name: Build and export
|
||||||
|
if: github.ref == 'refs/heads/master'
|
||||||
|
uses: docker/build-push-action@v3
|
||||||
|
with:
|
||||||
|
platforms: linux/386
|
||||||
|
context: scripts/
|
||||||
|
tags: tindy2013/subconverter:latest
|
||||||
|
build-args: |
|
||||||
|
SHA=${{ steps.vars.outputs.sha_short }}
|
||||||
|
THREADS=1
|
||||||
|
outputs: type=docker,dest=/tmp/image_386.tar
|
||||||
|
|
||||||
|
- name: Upload artifact
|
||||||
|
if: github.ref == 'refs/heads/master'
|
||||||
|
uses: actions/upload-artifact@v3
|
||||||
|
with:
|
||||||
|
name: image_386
|
||||||
|
path: /tmp/image_386.tar
|
||||||
|
|
||||||
|
- name: Replace tag without `v`
|
||||||
|
if: startsWith(github.ref, 'refs/tags/')
|
||||||
|
uses: actions/github-script@v1
|
||||||
|
id: version
|
||||||
|
with:
|
||||||
|
script: |
|
||||||
|
return context.payload.ref.replace(/\/?refs\/tags\/v/, '')
|
||||||
|
result-encoding: string
|
||||||
|
|
||||||
|
- name: Build release and export
|
||||||
|
if: startsWith(github.ref, 'refs/tags/')
|
||||||
|
uses: docker/build-push-action@v3
|
||||||
|
with:
|
||||||
|
platforms: linux/386
|
||||||
|
context: scripts/
|
||||||
|
tags: tindy2013/subconverter:${{steps.version.outputs.result}}
|
||||||
|
build-args: |
|
||||||
|
THREADS=1
|
||||||
|
outputs: type=docker,dest=/tmp/image_386_release.tar
|
||||||
|
|
||||||
|
|
||||||
|
- name: Upload release artifact
|
||||||
|
if: startsWith(github.ref, 'refs/tags/')
|
||||||
|
uses: actions/upload-artifact@v3
|
||||||
|
with:
|
||||||
|
name: image_386_release
|
||||||
|
path: /tmp/image_386_release.tar
|
||||||
|
|
||||||
|
armv7_build:
|
||||||
|
name: Build ARMv7 Image
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- name: Checkout base
|
||||||
|
uses: actions/checkout@v2
|
||||||
|
with:
|
||||||
|
fetch-depth: 0
|
||||||
|
|
||||||
|
- name: Set up Docker Buildx
|
||||||
|
uses: docker/setup-buildx-action@v2
|
||||||
|
|
||||||
|
- name: Get commit SHA
|
||||||
|
id: vars
|
||||||
|
run: echo "::set-output name=sha_short::$(git rev-parse --short HEAD)"
|
||||||
|
|
||||||
|
- name: Build and export
|
||||||
|
if: github.ref == 'refs/heads/master'
|
||||||
|
uses: docker/build-push-action@v3
|
||||||
|
with:
|
||||||
|
platforms: linux/arm/v7
|
||||||
|
context: scripts/
|
||||||
|
tags: tindy2013/subconverter:latest
|
||||||
|
build-args: |
|
||||||
|
SHA=${{ steps.vars.outputs.sha_short }}
|
||||||
|
THREADS=1
|
||||||
|
outputs: type=docker,dest=/tmp/image_armv7.tar
|
||||||
|
|
||||||
|
- name: Upload artifact
|
||||||
|
if: github.ref == 'refs/heads/master'
|
||||||
|
uses: actions/upload-artifact@v3
|
||||||
|
with:
|
||||||
|
name: image_armv7
|
||||||
|
path: /tmp/image_armv7.tar
|
||||||
|
|
||||||
|
- name: Replace tag without `v`
|
||||||
|
if: startsWith(github.ref, 'refs/tags/')
|
||||||
|
uses: actions/github-script@v1
|
||||||
|
id: version
|
||||||
|
with:
|
||||||
|
script: |
|
||||||
|
return context.payload.ref.replace(/\/?refs\/tags\/v/, '')
|
||||||
|
result-encoding: string
|
||||||
|
|
||||||
|
- name: Build release and export
|
||||||
|
if: startsWith(github.ref, 'refs/tags/')
|
||||||
|
uses: docker/build-push-action@v3
|
||||||
|
with:
|
||||||
|
platforms: linux/arm/v7
|
||||||
|
context: scripts/
|
||||||
|
tags: tindy2013/subconverter:${{steps.version.outputs.result}}
|
||||||
|
build-args: |
|
||||||
|
THREADS=1
|
||||||
|
outputs: type=docker,dest=/tmp/image_armv7_release.tar
|
||||||
|
|
||||||
|
|
||||||
|
- name: Upload release artifact
|
||||||
|
if: startsWith(github.ref, 'refs/tags/')
|
||||||
|
uses: actions/upload-artifact@v3
|
||||||
|
with:
|
||||||
|
name: image_armv7_release
|
||||||
|
path: /tmp/image_armv7_release.tar
|
||||||
|
|
||||||
|
arm64_build:
|
||||||
|
name: Build ARM64 Image
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- name: Checkout base
|
||||||
|
uses: actions/checkout@v2
|
||||||
|
with:
|
||||||
|
fetch-depth: 0
|
||||||
|
|
||||||
|
- name: Set up Docker Buildx
|
||||||
|
uses: docker/setup-buildx-action@v2
|
||||||
|
|
||||||
|
- name: Get commit SHA
|
||||||
|
id: vars
|
||||||
|
run: echo "::set-output name=sha_short::$(git rev-parse --short HEAD)"
|
||||||
|
|
||||||
|
- name: Build and export
|
||||||
|
if: github.ref == 'refs/heads/master'
|
||||||
|
uses: docker/build-push-action@v3
|
||||||
|
with:
|
||||||
|
platforms: linux/arm64
|
||||||
|
context: scripts/
|
||||||
|
tags: tindy2013/subconverter:latest
|
||||||
|
build-args: |
|
||||||
|
SHA=${{ steps.vars.outputs.sha_short }}
|
||||||
|
THREADS=1
|
||||||
|
outputs: type=docker,dest=/tmp/image_arm64.tar
|
||||||
|
|
||||||
|
- name: Upload artifact
|
||||||
|
if: github.ref == 'refs/heads/master'
|
||||||
|
uses: actions/upload-artifact@v3
|
||||||
|
with:
|
||||||
|
name: image_arm64
|
||||||
|
path: /tmp/image_arm64.tar
|
||||||
|
|
||||||
|
- name: Replace tag without `v`
|
||||||
|
if: startsWith(github.ref, 'refs/tags/')
|
||||||
|
uses: actions/github-script@v1
|
||||||
|
id: version
|
||||||
|
with:
|
||||||
|
script: |
|
||||||
|
return context.payload.ref.replace(/\/?refs\/tags\/v/, '')
|
||||||
|
result-encoding: string
|
||||||
|
|
||||||
|
- name: Build release and export
|
||||||
|
if: startsWith(github.ref, 'refs/tags/')
|
||||||
|
uses: docker/build-push-action@v3
|
||||||
|
with:
|
||||||
|
platforms: linux/arm64
|
||||||
|
context: scripts/
|
||||||
|
tags: tindy2013/subconverter:${{steps.version.outputs.result}}
|
||||||
|
build-args: |
|
||||||
|
THREADS=1
|
||||||
|
outputs: type=docker,dest=/tmp/image_arm64_release.tar
|
||||||
|
|
||||||
|
|
||||||
|
- name: Upload release artifact
|
||||||
|
if: startsWith(github.ref, 'refs/tags/')
|
||||||
|
uses: actions/upload-artifact@v3
|
||||||
|
with:
|
||||||
|
name: image_arm64_release
|
||||||
|
path: /tmp/image_arm64_release.tar
|
||||||
|
|
||||||
|
build:
|
||||||
|
name: Build
|
||||||
|
needs: [amd64_build, x86_build, armv7_build, arm64_build]
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- name: Checkout base
|
||||||
|
uses: actions/checkout@v2
|
||||||
|
with:
|
||||||
|
fetch-depth: 0
|
||||||
|
|
||||||
|
# https://github.com/docker/setup-qemu-action
|
||||||
|
- name: Set up QEMU
|
||||||
|
uses: docker/setup-qemu-action@v2
|
||||||
|
|
||||||
|
# https://github.com/docker/setup-buildx-action
|
||||||
|
- name: Set up Docker Buildx
|
||||||
|
uses: docker/setup-buildx-action@v2
|
||||||
|
with:
|
||||||
|
config-inline: |
|
||||||
|
[worker.oci]
|
||||||
|
max-parallelism = 1
|
||||||
|
|
||||||
|
- name: Download artifact
|
||||||
|
uses: actions/download-artifact@v3
|
||||||
|
with:
|
||||||
|
path: /tmp
|
||||||
|
|
||||||
|
- name: Load image
|
||||||
|
if: github.ref == 'refs/heads/master'
|
||||||
|
run: |
|
||||||
|
docker load --input /tmp/image_amd64/image_amd64.tar
|
||||||
|
docker load --input /tmp/image_386/image_386.tar
|
||||||
|
docker load --input /tmp/image_armv7/image_armv7.tar
|
||||||
|
docker load --input /tmp/image_arm64/image_arm64.tar
|
||||||
|
docker image ls -a
|
||||||
|
|
||||||
|
- name: Docker login
|
||||||
|
uses: docker/login-action@v2
|
||||||
|
with:
|
||||||
|
username: ${{ secrets.DOCKER_USERNAME }}
|
||||||
|
password: ${{ secrets.DOCKER_PASSWORD }}
|
||||||
|
|
||||||
|
- name: Get commit SHA
|
||||||
|
id: vars
|
||||||
|
run: echo "::set-output name=sha_short::$(git rev-parse --short HEAD)"
|
||||||
|
|
||||||
|
- name: Docker buildx image and push on master branch
|
||||||
|
if: github.ref == 'refs/heads/master'
|
||||||
|
uses: docker/build-push-action@v3
|
||||||
|
with:
|
||||||
|
platforms: linux/amd64,linux/arm/v7,linux/arm64,linux/386
|
||||||
|
context: scripts/
|
||||||
|
tags: tindy2013/subconverter:latest
|
||||||
|
build-args: |
|
||||||
|
SHA=${{ steps.vars.outputs.sha_short }}
|
||||||
|
THREADS=1
|
||||||
|
outputs: |
|
||||||
|
type=image,push=true
|
||||||
|
|
||||||
|
- name: Replace tag without `v`
|
||||||
|
if: startsWith(github.ref, 'refs/tags/')
|
||||||
|
uses: actions/github-script@v1
|
||||||
|
id: version
|
||||||
|
with:
|
||||||
|
script: |
|
||||||
|
return context.payload.ref.replace(/\/?refs\/tags\/v/, '')
|
||||||
|
result-encoding: string
|
||||||
|
|
||||||
|
- name: Load release image
|
||||||
if: startsWith(github.ref, 'refs/tags/')
|
if: startsWith(github.ref, 'refs/tags/')
|
||||||
run: |
|
run: |
|
||||||
docker buildx build --output "type=image,push=true" --platform=linux/amd64,linux/arm/v7,linux/arm64,linux/386 --tag tindy2013/subconverter:${{steps.version.outputs.result}} scripts/
|
docker load --input /tmp/image_amd64/image_amd64_release.tar
|
||||||
docker buildx build --output "type=image,push=true" --platform=linux/amd64,linux/arm/v7,linux/arm64,linux/386 --tag tindy2013/subconverter:latest scripts/
|
docker load --input /tmp/image_386/image_386_release.tar
|
||||||
|
docker load --input /tmp/image_armv7/image_armv7_release.tar
|
||||||
|
docker load --input /tmp/image_arm64/image_arm64_release.tar
|
||||||
|
docker image ls -a
|
||||||
|
|
||||||
|
- name: Docker buildx image and push on release
|
||||||
|
if: startsWith(github.ref, 'refs/tags/')
|
||||||
|
uses: docker/build-push-action@v3
|
||||||
|
with:
|
||||||
|
platforms: linux/amd64,linux/arm/v7,linux/arm64,linux/386
|
||||||
|
context: scripts/
|
||||||
|
tags: tindy2013/subconverter:${{steps.version.outputs.result}}
|
||||||
|
build-args: |
|
||||||
|
THREADS=1
|
||||||
|
outputs: |
|
||||||
|
type=image,push=true
|
||||||
Reference in new issue
Block a user