feat: update workflow to add latest tag for all images #8
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: Publish images to Docker Hub | |
on: | |
push: | |
branches: [master] | |
jobs: | |
push-golang-prod: | |
name: Publish image golang-prod | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
UBUNTU_VERSION: ["20.04", "22.04", "latest"] | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v3 | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v2 | |
- name: Login to DockerHub | |
uses: docker/login-action@v2 | |
with: | |
username: ${{ secrets.DOCKERHUB_USERNAME }} | |
password: ${{ secrets.DOCKERHUB_TOKEN }} | |
- name: Golang production image | |
uses: docker/build-push-action@v4 | |
with: | |
push: true | |
provenance: false | |
platforms: linux/amd64,linux/arm64 | |
context: ./golang-prod | |
tags: ${{ secrets.DOCKERHUB_USERNAME }}/golang-prod:${{ matrix.UBUNTU_VERSION }} | |
build-args: UBUNTU_VERSION=${{ matrix.UBUNTU_VERSION }} | |
push-golang-dev: | |
name: Publish image golang-dev | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
GOLANG_VERSION: ["1.20", "1.21", "latest"] | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v3 | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v2 | |
- name: Login to DockerHub | |
uses: docker/login-action@v2 | |
with: | |
username: ${{ secrets.DOCKERHUB_USERNAME }} | |
password: ${{ secrets.DOCKERHUB_TOKEN }} | |
- name: Build and push image | |
uses: docker/build-push-action@v4 | |
with: | |
push: true | |
provenance: false | |
platforms: linux/amd64,linux/arm64 | |
context: ./golang-dev | |
tags: ${{ secrets.DOCKERHUB_USERNAME }}/golang-dev:${{ matrix.GOLANG_VERSION }} | |
build-args: GOLANG_VERSION=${{ matrix.GOLANG_VERSION }} | |
push-ubuntu-sshd: | |
name: Publish image ubuntu-sshd | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
UBUNTU_VERSION: ["20.04", "22.04", "latest"] | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v3 | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v2 | |
- name: Login to DockerHub | |
uses: docker/login-action@v2 | |
with: | |
username: ${{ secrets.DOCKERHUB_USERNAME }} | |
password: ${{ secrets.DOCKERHUB_TOKEN }} | |
- name: Ubuntu image with sshd | |
uses: docker/build-push-action@v4 | |
with: | |
push: true | |
provenance: false | |
platforms: linux/amd64,linux/arm64 | |
context: ./ubuntu-sshd | |
tags: ${{ secrets.DOCKERHUB_USERNAME }}/ubuntu-sshd:${{ matrix.UBUNTU_VERSION }} | |
build-args: UBUNTU_VERSION=${{ matrix.UBUNTU_VERSION }} |