Update golang Docker tag to v1.23.4 (#21) #51
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: Docker build and push | |
on: | |
push: | |
branches: | |
- 'main' | |
env: | |
IMAGE_NAME: larmic/golang-starter-example | |
# cancel jobs in current pr if new commit is done | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} | |
cancel-in-progress: true | |
jobs: | |
build: | |
name: Build | |
runs-on: ubuntu-latest | |
steps: | |
- name: Check out code into the Go module directory | |
uses: actions/checkout@v4 | |
- name: Set up version # will be read by Dockerfile to set version in open-api-3.yaml | |
run: echo "VERSION=$(cat VERSION)" >> $GITHUB_ENV | |
- name: Login to DockerHub | |
uses: docker/login-action@v3 | |
with: | |
username: ${{ secrets.DOCKER_USERNAME }} | |
password: ${{ secrets.DOCKER_PASSWORD }} | |
- name: Set up QEMU | |
uses: docker/setup-qemu-action@v3 | |
- name: prepare buildx | |
run: | | |
# Use docker-container driver to allow useful features (push/multi-platform) | |
docker buildx create --driver docker-container --use | |
docker buildx inspect --bootstrap | |
- name: build image | |
run: | | |
update-binfmts --enable # Important: Ensures execution of other binary formats is enabled in the kernel | |
docker buildx build --platform=linux/amd64,linux/arm64,linux/arm --build-arg VERSION=$VERSION --pull --tag "$IMAGE_NAME:$VERSION" --tag "$IMAGE_NAME:latest" . --push |