Skip to content

NOARM

NOARM #8

name: Build Devcontainer Image
on:
push:
branches:
- main
workflow_dispatch:
inputs:
force_rebuild:
description: 'Force rebuild without cache'
type: boolean
default: false
jobs:
build-and-push-devcontainer:
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Log in to Container Registry
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Extract metadata
id: meta
uses: docker/metadata-action@v5
with:
images: ghcr.io/${{ github.repository }}/devcontainer
tags: |
type=ref,event=branch
type=sha
type=raw,value=latest,enable={{is_default_branch}}
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Build and push Docker image
uses: docker/build-push-action@v5
with:
context: .
file: .devcontainer/Dockerfile
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
platforms: linux/amd64
cache-from: ${{ github.event.inputs.force_rebuild != 'true' && 'type=gha' || '' }}
cache-to: type=gha,mode=max