[Auto Generation] Changes : apps/docker-gdsa/Dockerfile #3655
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: Release | |
on: | |
workflow_dispatch: | |
push: | |
branches: | |
- master | |
paths: | |
- 'apps/**' | |
- 'base/**' | |
- 'mod/**' | |
- 'nightly/**' | |
env: | |
GOSS_SLEEP: 30 | |
MOBY: "moby/buildkit:latest" | |
PLATFORM: "linux/amd64,linux/arm64" | |
DOCKER_CLI_EXPERIMENTAL: enabled | |
LICENSE: "GPL-3.0 DockServer.io" | |
SOURCE: "https://github.com/dockserver/container" | |
CODE_OWNED: "base image LSIO, changes dockserver.io" | |
CACHE: "gha" | |
jobs: | |
changes: | |
name: Get changes | |
runs-on: ubuntu-latest | |
#runs-on: self-hosted | |
outputs: | |
matrix: "{\"container\": ${{ steps.reduce.outputs.containers }} }" | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
with: | |
repository: ${{ github.repository }} | |
token: ${{ secrets.CR_PAT }} | |
fetch-depth: 0 | |
- uses: dorny/paths-filter@v3 | |
id: filter | |
with: | |
list-files: json | |
filters: | | |
changed: | |
- 'apps/**' | |
- 'base/**' | |
- 'mod/**' | |
- 'nightly/**' | |
- run: echo '${{ toJson(steps.filter.outputs) }}' > changes.json | |
- id: reduce | |
run: | | |
CONTAINERS=$(jq --raw-output '.changed_files | fromjson | .[] |= sub("(?<filepath>(?<first_directory>(?<root1>[/]?)[^/]+/)(?<second_directory>(?<root2>[/]?)[^/]+)(?<extra_paths>.+))"; "\(.second_directory)") | unique' changes.json) | |
echo ::set-output name=containers::${CONTAINERS} | |
build: | |
name: Build Docker | |
runs-on: ubuntu-latest | |
##runs-on: self-hosted | |
continue-on-error: true | |
permissions: | |
contents: read | |
packages: write | |
id-token: write | |
actions: write | |
checks: write | |
needs: | |
- changes | |
strategy: | |
max-parallel: 16 | |
fail-fast: false | |
matrix: ${{ fromJson(needs.changes.outputs.matrix) }} | |
if: "!contains(github.event.head_commit.message, '[ci-skip]')" | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
with: | |
repository: ${{ github.repository }} | |
token: ${{ secrets.CR_PAT }} | |
fetch-depth: 0 | |
- name: Prepare | |
id: prep | |
run: | | |
if test -f "./apps/${{ matrix.container }}/Dockerfile"; then | |
CATEGORY="apps" | |
elif test -f "./mod/${{ matrix.container }}/Dockerfile"; then | |
CATEGORY="mod" | |
elif test -f "./nightly/${{ matrix.container }}/Dockerfile"; then | |
CATEGORY="nightly" | |
else | |
CATEGORY="base" | |
fi | |
echo "category=${CATEGORY}" >> $GITHUB_OUTPUT | |
VERSION=$(jq -r '.newversion' < ./${CATEGORY}/${{ matrix.container }}/release.json) | |
echo "version=${VERSION}" >> $GITHUB_OUTPUT | |
DESCRIPTION=$(jq -r '.description' < ./${CATEGORY}/${{ matrix.container }}/release.json) | |
echo "description=${DESCRIPTION}" >> $GITHUB_OUTPUT | |
echo "platform=${PLATFORM}" >> $GITHUB_OUTPUT | |
echo "shashort=$(echo ${GITHUB_SHA} | cut -c1-8)" >> $GITHUB_OUTPUT | |
CREATED="$(date +%Y-%m-%d)" | |
echo "created=${CREATED}" >> $GITHUB_OUTPUT | |
echo "platformout=${{ env.PLATFORM }}" >> $GITHUB_OUTPUT | |
echo "linc=${{ env.LICENSE }}" >> $GITHUB_OUTPUT | |
echo "owndocker=${{ env.CODE_OWNED }}" >> $GITHUB_OUTPUT | |
if [ "${{ github.event_name }}" == "pull_request" ]; then | |
echo "push=false" >> $GITHUB_OUTPUT | |
else | |
echo "push=true" >> $GITHUB_OUTPUT | |
fi | |
- name: Set up QEMU | |
if: ${{ steps.prep.outputs.version != '' }} | |
uses: docker/[email protected] | |
with: | |
platforms: ${{ steps.prep.outputs.platformout }} | |
- name: Login in Registry || major | |
if: ${{ steps.prep.outputs.version != '' }} | |
uses: docker/[email protected] | |
with: | |
registry: ${{ secrets.DOCKER_REGISTRY }} | |
username: ${{ github.actor }} | |
password: ${{ secrets.CR_PAT }} | |
- name: Login in Registry || mirror | |
uses: docker/[email protected] | |
if: ${{ steps.prep.outputs.version != '' }} | |
with: | |
registry: ${{ secrets.OWN_REGISTRY }} | |
username: ${{ secrets.QR_LOGIN }} | |
password: ${{ secrets.CR_QUAI }} | |
- name: Set up Docker Buildx | |
if: ${{ steps.prep.outputs.version != '' }} | |
id: buildx | |
uses: docker/[email protected] | |
with: | |
install: true | |
buildkitd-flags: --debug | |
version: latest | |
driver: docker-container | |
driver-opts: | | |
image=${{ env.MOBY }} | |
network=host | |
- name: Extract Docker metadata | |
if: ${{ steps.prep.outputs.version != '' }} | |
id: meta | |
uses: docker/metadata-action@8e1d5461f02b7886d3c1a774bfbd873650445aa2 | |
with: | |
images: ${{ secrets.DOCKER_REGISTRY }}/${{ github.repository_owner }}/${{ matrix.container }} | |
- name: Build and Push Image | |
if: ${{ steps.prep.outputs.version != '' }} | |
id: build-and-push | |
uses: docker/[email protected] | |
with: | |
build-args: VERSION=${{ steps.prep.outputs.version }} | |
context: . | |
platforms: ${{ steps.prep.outputs.platformout }} | |
file: ./${{ steps.prep.outputs.category }}/${{ matrix.container }}/Dockerfile | |
push: ${{ steps.prep.outputs.push }} | |
tags: | | |
${{ secrets.DOCKER_REGISTRY }}/${{ github.repository_owner }}/${{ matrix.container }}:latest | |
${{ secrets.DOCKER_REGISTRY }}/${{ github.repository_owner }}/${{ matrix.container }}:${{ steps.prep.outputs.shashort }} | |
${{ secrets.DOCKER_REGISTRY }}/${{ github.repository_owner }}/${{ matrix.container }}:${{ steps.prep.outputs.created }} | |
${{ secrets.DOCKER_REGISTRY }}/${{ github.repository_owner }}/${{ matrix.container }}:${{ steps.prep.outputs.version }} | |
${{ secrets.DOCKER_REGISTRY }}/${{ github.repository_owner }}/${{ matrix.container }}:v${{ steps.prep.outputs.version }} | |
${{ secrets.OWN_REGISTRY }}/${{ github.repository_owner }}/${{ matrix.container }}:latest | |
${{ secrets.OWN_REGISTRY }}/${{ github.repository_owner }}/${{ matrix.container }}:${{ steps.prep.outputs.shashort }} | |
${{ secrets.OWN_REGISTRY }}/${{ github.repository_owner }}/${{ matrix.container }}:${{ steps.prep.outputs.created }} | |
${{ secrets.OWN_REGISTRY }}/${{ github.repository_owner }}/${{ matrix.container }}:${{ steps.prep.outputs.version }} | |
${{ secrets.OWN_REGISTRY }}/${{ github.repository_owner }}/${{ matrix.container }}:v${{ steps.prep.outputs.version }} | |
labels: | | |
maintainer=${{ github.repository_owner }} | |
org.opencontainers.image.title=${{ matrix.container }} | |
org.opencontainers.image.source=https://github.com/${{ github.repository }} | |
org.opencontainers.image.version=${{ steps.prep.outputs.version }} | |
org.opencontainers.image.maintainer=${{ github.repository_owner }} | |
org.opencontainers.image.created=${{ steps.prep.outputs.created }} | |
org.opencontainers.image.authors=${{ github.repository_owner }} | |
org.opencontainers.image.vendor=${{ github.repository_owner }} | |
org.opencontainers.image.platform=${{ steps.prep.outputs.platformout }} | |
org.opencontainers.image.license=${{ steps.prep.outputs.linc }} | |
org.opencontainers.image.description=${{ steps.prep.outputs.description }} | |
org.opencontainers.image.owner=${{ steps.prep.outputs.owndocker }} | |
org.opencontainers.image.shaid=${{ steps.prep.outputs.shashort }} | |
- name: Image digest | |
if: ${{ steps.prep.outputs.version != '' }} | |
run: echo ${{ steps.docker_build.outputs.digest }} | |
- name: Send notification | |
if: ${{ steps.prep.outputs.version != '' }} | |
env: | |
DISCORD_WEBHOOK: ${{ secrets.DISCORD_IMAGES }} | |
VERSION: ${{ steps.prep.outputs.version }} | |
SHA8: ${{ steps.prep.outputs.shashort }} | |
CATEGORY: ${{ steps.prep.outputs.category }} | |
DESCRIPTION: ${{ steps.prep.outputs.description }} | |
COLOR: 3066993 | |
shell: bash | |
run: | | |
if [[ -f "./images/${{ matrix.container }}.png" ]]; then | |
cp -r "./images/${{ matrix.container }}.png" image.png | |
else | |
cp -r "./images/image.png" image.png | |
fi | |
export DOCKER_CLI_EXPERIMENTAL=enabled | |
json='{ | |
"username": "Docker Image Update", | |
"avatar_url": "https://github.com/dockserver/dockserver/raw/master/wiki/overrides/img/profile.png", | |
"embeds": [ | |
{ | |
"author": { | |
"name": "'${{ github.repository_owner }}'" | |
}, | |
"title": "'${{ matrix.container }}'", | |
"url": "https://github.com/orgs/'${{ github.repository_owner }}'/packages/container/package/'${{ matrix.container }}'", | |
"color": '${COLOR}', | |
"fields": [ | |
{ | |
"name": "Container Info", | |
"value": "We published a new container image '${{ matrix.container }}'" | |
}, | |
{ | |
"name": "Description of docker", | |
"value": "`'${DESCRIPTION}'`" | |
}, | |
{ | |
"name": "Version", | |
"value": "new Version public : `'${VERSION}'` with `'${SHA8}'`" | |
}, | |
{ | |
"name": "Docker Tags : '${{ secrets.DOCKER_REGISTRY }}'", | |
"value": "`'${{ secrets.DOCKER_REGISTRY }}'/'${{ github.repository_owner }}'/'${{ matrix.container }}':latest`\nor\n`'${{ secrets.DOCKER_REGISTRY }}'/'${{ github.repository_owner }}'/'${{ matrix.container }}':v'${VERSION:----}'`" | |
}, | |
{ | |
"name": "Docker Tags : Dockserver Registry", | |
"value": "`docker.dockserver.io/'${{ github.repository_owner }}'/'${{ matrix.container }}':latest`\nor\n`docker.dockserver.io/'${{ github.repository_owner }}'/'${{ matrix.container }}':v'${VERSION}'`" | |
}, | |
{ | |
"name": "Thanks!", | |
"value": "Thanks! to all Contributors" | |
} | |
], | |
"footer": { | |
"text": "Powered by GitHub Actions", | |
"icon_url": "https://github.githubassets.com/images/modules/logos_page/GitHub-Mark.png" | |
}, | |
"timestamp": "'$(date -u +'%FT%T.%3NZ')'", | |
"image": { | |
"url": "attachment://image.png" | |
} | |
} | |
] | |
}' | |
curl -fsSL --retry 5 -H "Content-Type: multipart/form-data" -F "[email protected]" -F "payload_json=${json}" "${DISCORD_WEBHOOK}" > /dev/null |