godev-container-building #21
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: godev-container-building | |
on: | |
workflow_dispatch: | |
inputs: | |
version: | |
description: 'The version of Go to build on top of' | |
required: true | |
type: string | |
os: | |
description: 'The operating system base to use, like alpine, and should start with a -' | |
required: false | |
type: string | |
default: '' | |
env: | |
VERSION: ${{ github.event.inputs.version }} | |
OS: ${{ github.event.inputs.os }} | |
jobs: | |
build-containers-ghcr: | |
runs-on: ubuntu-latest | |
steps: | |
- name: 'Checkout the code' | |
uses: actions/checkout@v2 | |
- name: 'Log into GHCR' | |
uses: docker/login-action@v1 | |
with: | |
registry: ghcr.io | |
username: ${{ github.actor }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- name: 'Extract metadata (tags, labels) for the container.' | |
id: meta | |
uses: docker/metadata-action@v3 | |
with: | |
images: ghcr.io/bzvestey/godev | |
tags: | | |
${{ env.VERSION }}${{ env.OS }} | |
latest | |
- name: 'Build and Push the container.' | |
uses: docker/build-push-action@v2 | |
with: | |
context: ./godev | |
push: true | |
tags: ${{ steps.meta.outputs.tags }} | |
build-args: | | |
version=${{ env.VERSION }} | |
os=${{ env.OS }} | |