Publish images to Docker Hub #2
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: | |
workflow_dispatch: | |
inputs: | |
UBUNTU_VERSION: | |
description: 'Ubuntu version' | |
GOLANG_VERSION: | |
description: 'Golang version' | |
jobs: | |
push-golang-prod: | |
name: Publish image golang-prod | |
runs-on: ubuntu-latest | |
if: github.event.inputs.UBUNTU_VERSION != '' | |
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:${{ github.event.inputs.UBUNTU_VERSION }} | |
build-args: UBUNTU_VERSION=${{ github.event.inputs.UBUNTU_VERSION }} | |
push-golang-dev: | |
name: Publish image golang-dev | |
runs-on: ubuntu-latest | |
if: github.event.inputs.GOLANG_VERSION != '' | |
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:${{ github.event.inputs.GOLANG_VERSION }} | |
build-args: GOLANG_VERSION=${{ github.event.inputs.GOLANG_VERSION }} | |
push-ubuntu-sshd: | |
name: Publish image ubuntu-sshd | |
runs-on: ubuntu-latest | |
if: github.event.inputs.UBUNTU_VERSION != '' | |
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:${{ github.event.inputs.UBUNTU_VERSION }} | |
build-args: UBUNTU_VERSION=${{ github.event.inputs.UBUNTU_VERSION }} |