deploy single image #10
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: deploy single image | |
on: | |
workflow_dispatch: | |
inputs: | |
base_image: | |
description: 'Base image to use' | |
type: string | |
default: 'ubuntu:22.04' | |
dotfiles_env: | |
description: 'Env prefix for dotfiles' | |
type: string | |
default: '' | |
dotfiles_args: | |
description: 'Args for dotfiles' | |
type: string | |
default: 'set -C base' | |
tag: | |
description: 'Tag for image' | |
type: string | |
required: true | |
deploy: | |
description: 'Deploy to registry' | |
type: boolean | |
default: false | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout dev-env | |
uses: actions/checkout@v4 | |
- name: Checkout dotfiles | |
uses: actions/checkout@v4 | |
with: | |
repository: duskmoon314/dotfiles | |
path: dotfiles | |
- name: Set up QEMU | |
uses: docker/setup-qemu-action@v3 | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v3 | |
- name: Login to DockerHub | |
uses: docker/login-action@v3 | |
with: | |
username: ${{ secrets.DOCKERHUB_USERNAME }} | |
password: ${{ secrets.DOCKERHUB_TOKEN }} | |
- name: Build and push | |
uses: docker/build-push-action@v5 | |
with: | |
build-args: | | |
BASE_IMG=${{ github.event.inputs.base_image }} | |
DOTFILES_ENV=${{ github.event.inputs.dotfiles_env }} | |
DOTFILES_ARGS=${{ github.event.inputs.dotfiles_args }} | |
context: . | |
platforms: linux/amd64,linux/arm64 | |
push: ${{ github.event.inputs.deploy }} | |
tags: | | |
duskmoon/dev-env:${{ github.event.inputs.tag }} | |
cache-from: type=registry,ref=duskmoon/dev-env:${{ github.event.inputs.tag }} | |
cache-to: type=inline |