Skip to content

Build Devcontainer image #364

Build Devcontainer image

Build Devcontainer image #364

name: Build Devcontainer image
on:
workflow_dispatch:
# no content, allows manual triggering
schedule:
# 5:30 pm every Sunday (UTC)
# to pick up any important bug fixes etc in base image
- cron: '30 17 * * 0'
push:
# run when changes pushed to main branch if any devcontainer files changed
branches:
- main
paths:
- .devcontainer/**
jobs:
# Based on: https://docs.github.com/en/actions/guides/publishing-docker-images#publishing-images-to-github-packages
build-devcontainer-image:
runs-on: ubuntu-latest
permissions:
packages: write
contents: read
# Only run this scheduled job on the main repo, it can't work elsewhere
if: ${{ github.repository == 'Azure/azure-service-operator' }}
steps:
- name: Checkout code
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # pinned to 6.0.2
- name: Log in to GitHub Docker Registry
uses: docker/login-action@4907a6ddec9925e35a0a9e82d7399ccc52663121 # pinned to v4.1.0
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Build & push Devcontainer image
uses: docker/build-push-action@bcafcacb16a39f128d818304e6c9c0c18556b85f # pinned to v7.1.0
with:
context: .
file: .devcontainer/Dockerfile
push: true
# Embed inline cache metadata so consumers can use --cache-from
cache-to: type=inline
tags: |
ghcr.io/azure/azure-service-operator/aso-devcontainer:latest
ghcr.io/azure/azure-service-operator/aso-devcontainer:${{ github.sha }}