diff --git a/.github/workflows/hub_docker_ci.yml b/.github/workflows/hub_docker_ci.yml new file mode 100644 index 0000000000..f090072d0c --- /dev/null +++ b/.github/workflows/hub_docker_ci.yml @@ -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' }}