[DOCKER] Use Gha docker metadata actions to setup all the github actions (#1116)
This commit is contained in:
parent
52038ed999
commit
0f542ac4e5
3 changed files with 85 additions and 36 deletions
40
.github/workflows/package-gui.yaml
vendored
40
.github/workflows/package-gui.yaml
vendored
|
|
@ -247,7 +247,7 @@ jobs:
|
||||||
# Change all uppercase to lowercase
|
# Change all uppercase to lowercase
|
||||||
IMAGE_ID=$(echo $IMAGE_ID | tr '[A-Z]' '[a-z]')
|
IMAGE_ID=$(echo $IMAGE_ID | tr '[A-Z]' '[a-z]')
|
||||||
echo IMAGE_ID=${IMAGE_ID}
|
echo IMAGE_ID=${IMAGE_ID}
|
||||||
|
|
||||||
echo ::set-output name=IMAGE_ID::${IMAGE_ID}
|
echo ::set-output name=IMAGE_ID::${IMAGE_ID}
|
||||||
|
|
||||||
- name: Get the version
|
- name: Get the version
|
||||||
|
|
@ -260,17 +260,33 @@ jobs:
|
||||||
# Use Docker `latest` tag convention
|
# Use Docker `latest` tag convention
|
||||||
[ "$VERSION" == "master" ] && VERSION=latest
|
[ "$VERSION" == "master" ] && VERSION=latest
|
||||||
echo VERSION=${VERSION}
|
echo VERSION=${VERSION}
|
||||||
|
|
||||||
echo ::set-output name=VERSION::${VERSION}
|
echo ::set-output name=VERSION::${VERSION}
|
||||||
|
|
||||||
|
- name: Docker meta
|
||||||
|
id: meta
|
||||||
|
uses: docker/metadata-action@v5
|
||||||
|
with:
|
||||||
|
images: ${{ steps.formatted-image_id.outputs.IMAGE_ID }}
|
||||||
|
labels: |
|
||||||
|
runnumber=${{ github.run_number }}
|
||||||
|
maintainer=${{ github.repository_owner }}
|
||||||
|
org.opencontainers.image.authors=${{ github.repository_owner }}
|
||||||
|
org.opencontainers.image.vendor=${{ github.repository_owner }}
|
||||||
|
org.opencontainers.image.documentation=https://ytdl-sub.readthedocs.io/
|
||||||
|
tags: |
|
||||||
|
type=raw,value=${{ steps.formatted_version.outputs.VERSION }}
|
||||||
|
type=raw,value=${{ needs.version.outputs.pypi_version }}
|
||||||
|
|
||||||
- name: Build Docker Image and push to registry
|
- name: Build Docker Image and push to registry
|
||||||
run: |
|
uses: docker/build-push-action@v6
|
||||||
docker buildx build --push \
|
with:
|
||||||
--platform=linux/amd64,linux/arm64 \
|
platforms: linux/amd64,linux/arm64
|
||||||
--cache-from=type=local,src=/tmp/build-cache/amd64 \
|
push: true
|
||||||
--cache-from=type=local,src=/tmp/build-cache/arm64 \
|
tags: ${{ steps.meta.outputs.tags }}
|
||||||
--tag ${{ steps.formatted-image_id.outputs.IMAGE_ID }}:${{ steps.formatted_version.outputs.VERSION }} \
|
labels: ${{ steps.meta.outputs.labels }}
|
||||||
--tag ${{ steps.formatted-image_id.outputs.IMAGE_ID }}:${{ needs.version.outputs.pypi_version }} \
|
context: "docker/"
|
||||||
--label "runnumber=${GITHUB_RUN_ID}" \
|
file: "docker/Dockerfile.gui"
|
||||||
--file docker/Dockerfile.gui \
|
cache-from: |
|
||||||
docker/
|
type=local,src=/tmp/build-cache/amd64
|
||||||
|
type=local,src=/tmp/build-cache/arm64
|
||||||
|
|
|
||||||
40
.github/workflows/package-ubuntu.yaml
vendored
40
.github/workflows/package-ubuntu.yaml
vendored
|
|
@ -247,7 +247,7 @@ jobs:
|
||||||
# Change all uppercase to lowercase
|
# Change all uppercase to lowercase
|
||||||
IMAGE_ID=$(echo $IMAGE_ID | tr '[A-Z]' '[a-z]')
|
IMAGE_ID=$(echo $IMAGE_ID | tr '[A-Z]' '[a-z]')
|
||||||
echo IMAGE_ID=${IMAGE_ID}
|
echo IMAGE_ID=${IMAGE_ID}
|
||||||
|
|
||||||
echo ::set-output name=IMAGE_ID::${IMAGE_ID}
|
echo ::set-output name=IMAGE_ID::${IMAGE_ID}
|
||||||
|
|
||||||
- name: Get the version
|
- name: Get the version
|
||||||
|
|
@ -260,17 +260,33 @@ jobs:
|
||||||
# Use Docker `latest` tag convention
|
# Use Docker `latest` tag convention
|
||||||
[ "$VERSION" == "master" ] && VERSION=latest
|
[ "$VERSION" == "master" ] && VERSION=latest
|
||||||
echo VERSION=${VERSION}
|
echo VERSION=${VERSION}
|
||||||
|
|
||||||
echo ::set-output name=VERSION::${VERSION}
|
echo ::set-output name=VERSION::${VERSION}
|
||||||
|
|
||||||
|
- name: Docker meta
|
||||||
|
id: meta
|
||||||
|
uses: docker/metadata-action@v5
|
||||||
|
with:
|
||||||
|
images: ${{ steps.formatted-image_id.outputs.IMAGE_ID }}
|
||||||
|
labels: |
|
||||||
|
runnumber=${{ github.run_number }}
|
||||||
|
maintainer=${{ github.repository_owner }}
|
||||||
|
org.opencontainers.image.authors=${{ github.repository_owner }}
|
||||||
|
org.opencontainers.image.vendor=${{ github.repository_owner }}
|
||||||
|
org.opencontainers.image.documentation=https://ytdl-sub.readthedocs.io/
|
||||||
|
tags: |
|
||||||
|
type=raw,value=ubuntu-${{ steps.formatted_version.outputs.VERSION }}
|
||||||
|
type=raw,value=ubuntu-${{ needs.version.outputs.pypi_version }}
|
||||||
|
|
||||||
- name: Build Docker Image and push to registry
|
- name: Build Docker Image and push to registry
|
||||||
run: |
|
uses: docker/build-push-action@v6
|
||||||
docker buildx build --push \
|
with:
|
||||||
--platform=linux/amd64,linux/arm64 \
|
platforms: linux/amd64,linux/arm64
|
||||||
--cache-from=type=local,src=/tmp/build-cache/amd64 \
|
push: true
|
||||||
--cache-from=type=local,src=/tmp/build-cache/arm64 \
|
tags: ${{ steps.meta.outputs.tags }}
|
||||||
--tag ${{ steps.formatted-image_id.outputs.IMAGE_ID }}:ubuntu-${{ steps.formatted_version.outputs.VERSION }} \
|
labels: ${{ steps.meta.outputs.labels }}
|
||||||
--tag ${{ steps.formatted-image_id.outputs.IMAGE_ID }}:ubuntu-${{ needs.version.outputs.pypi_version }} \
|
context: "docker/"
|
||||||
--label "runnumber=ubuntu-${GITHUB_RUN_ID}" \
|
file: "docker/Dockerfile.ubuntu"
|
||||||
--file docker/Dockerfile.ubuntu \
|
cache-from: |
|
||||||
docker/
|
type=local,src=/tmp/build-cache/amd64
|
||||||
|
type=local,src=/tmp/build-cache/arm64
|
||||||
|
|
|
||||||
41
.github/workflows/package.yaml
vendored
41
.github/workflows/package.yaml
vendored
|
|
@ -241,7 +241,7 @@ jobs:
|
||||||
# Change all uppercase to lowercase
|
# Change all uppercase to lowercase
|
||||||
IMAGE_ID=$(echo $IMAGE_ID | tr '[A-Z]' '[a-z]')
|
IMAGE_ID=$(echo $IMAGE_ID | tr '[A-Z]' '[a-z]')
|
||||||
echo IMAGE_ID=${IMAGE_ID}
|
echo IMAGE_ID=${IMAGE_ID}
|
||||||
|
|
||||||
echo ::set-output name=IMAGE_ID::${IMAGE_ID}
|
echo ::set-output name=IMAGE_ID::${IMAGE_ID}
|
||||||
|
|
||||||
- name: Get the version
|
- name: Get the version
|
||||||
|
|
@ -254,16 +254,33 @@ jobs:
|
||||||
# Use Docker `latest` tag convention
|
# Use Docker `latest` tag convention
|
||||||
[ "$VERSION" == "master" ] && VERSION=latest
|
[ "$VERSION" == "master" ] && VERSION=latest
|
||||||
echo VERSION=${VERSION}
|
echo VERSION=${VERSION}
|
||||||
|
|
||||||
echo ::set-output name=VERSION::${VERSION}
|
echo ::set-output name=VERSION::${VERSION}
|
||||||
|
|
||||||
- name: Build Docker Image and push to registry
|
|
||||||
run: |
|
- name: Docker meta
|
||||||
docker buildx build --push \
|
id: meta
|
||||||
--platform=linux/amd64,linux/arm64 \
|
uses: docker/metadata-action@v5
|
||||||
--cache-from=type=local,src=/tmp/build-cache/amd64 \
|
with:
|
||||||
--cache-from=type=local,src=/tmp/build-cache/arm64 \
|
images: ${{ steps.formatted-image_id.outputs.IMAGE_ID }}
|
||||||
--tag ${{ steps.formatted-image_id.outputs.IMAGE_ID }}:${{ steps.formatted_version.outputs.VERSION }} \
|
labels: |
|
||||||
--tag ${{ steps.formatted-image_id.outputs.IMAGE_ID }}:${{ needs.version.outputs.pypi_version }} \
|
runnumber=${{ github.run_number }}
|
||||||
--label "runnumber=${GITHUB_RUN_ID}" \
|
maintainer=${{ github.repository_owner }}
|
||||||
docker/
|
org.opencontainers.image.authors=${{ github.repository_owner }}
|
||||||
|
org.opencontainers.image.vendor=${{ github.repository_owner }}
|
||||||
|
org.opencontainers.image.documentation=https://ytdl-sub.readthedocs.io/
|
||||||
|
tags: |
|
||||||
|
type=raw,value=${{ steps.formatted_version.outputs.VERSION }}
|
||||||
|
type=raw,value=${{ needs.version.outputs.pypi_version }}
|
||||||
|
|
||||||
|
- name: Build and push
|
||||||
|
uses: docker/build-push-action@v6
|
||||||
|
with:
|
||||||
|
platforms: linux/amd64,linux/arm64
|
||||||
|
push: true
|
||||||
|
tags: ${{ steps.meta.outputs.tags }}
|
||||||
|
labels: ${{ steps.meta.outputs.labels }}
|
||||||
|
context: "docker/"
|
||||||
|
cache-from: |
|
||||||
|
type=local,src=/tmp/build-cache/amd64
|
||||||
|
type=local,src=/tmp/build-cache/arm64
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue