ci: add hub_docker_ci.yml, for building docker images (triggered manually for now) (#22302)

This commit is contained in:
Jakub Jabłoński 2024-09-25 07:43:16 +02:00 committed by GitHub
parent 41e045c553
commit 14bf78d66d
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

81
.github/workflows/hub_docker_ci.yml vendored Normal file
View file

@ -0,0 +1,81 @@
name: hub_docker_ci
on:
workflow_dispatch:
jobs:
publish-new-docker-images:
strategy:
matrix:
os: [debian, alpine]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
repository: 'vlang/docker'
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Login to hub.docker.com
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
# - name: Docker build
# run: |
# docker build -f Dockerfile.${{ matrix.os }} --platform linux/amd64,linux/arm64 -t thevlang/vlang:{{ version }} -t thevlang/vlang:latest
#
# - name: Docker push
# run: |
# docker push thevlang/vlang:{{ version }} thevlang/vlang:latest
#
# - uses: docker/build-push-action@v4
# with:
# platforms: ${{ vars.PLATFORMS}}
# tags: ${{ vars.DOCKER_REPOSITORY }}/vlang:${{ matrix.os}}-build
# push: ${{ github.event_name != 'pull_request' }}
# file: docker/vlang/Dockerfile.${{ matrix.os }}.build
# build-args: "USER=${{vars.DOCKER_REPOSITORY}}"
#
# - name: Build and push
# uses: docker/build-push-action@v2
# with:
# context: .
# file: ./Dockerfile
# push: true
# tags: agasdrm/blog:latest,agasdrm/blog:${{ github.run_number }}
# platforms: linux/amd64,linux/arm64/v8
# cache-from: type=local,src=/tmp/.buildx-cache
# cache-to: type=local,dest=/tmp/.buildx-cache
- name: generate tags conditionally
id: gen_tags
run: |
if [[ ${{ matrix.os }} == 'debian' ]]; then
echo 'TAGS=thevlang/vlang:latest,thevlang/vlang:${{ matrix.os }}' >> $GITHUB_OUTPUT
else
echo 'TAGS=thevlang/vlang:${{ matrix.os }}' >> $GITHUB_OUTPUT
fi
- uses: docker/build-push-action@v4
name: Build and deploy v image
with:
platforms: linux/amd64,linux/arm64
tags: ${{ steps.gen_tags.outputs.TAGS }}
file: docker/vlang/Dockerfile.${{ matrix.os }}
push: ${{ github.event_name != 'pull_request' }}
build-args: 'USER=thevlang'
- uses: docker/build-push-action@v4
name: Build and deploy developer build
with:
platforms: linux/amd64,linux/arm64
tags: thevlang/vlang:${{ matrix.os }}-dev
file: docker/vlang/Dockerfile.${{ matrix.os }}.dev-full
build-args: 'USER=thevlang'
push: ${{ github.event_name != 'pull_request' }}