Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Build & push Devcontainer image to GitHub Container Registry #1580

Merged
merged 4 commits into from
Jun 20, 2021
Merged
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
49 changes: 49 additions & 0 deletions .github/workflows/build-devcontainer-image.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
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 * * 7'
Porges marked this conversation as resolved.
Show resolved Hide resolved

push:
# run when changes pushed to master if any devcontainer files changed
branches:
- master
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

steps:
- name: Checkout code
uses: actions/checkout@v2
with:
submodules: 'true'

- name: Log in to GitHub Docker Registry
uses: docker/login-action@v1
with:
registry: docker.pkg.github.com
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }

- name: Build & push Devcontainer image
uses: docker/build-push-action@v2
with:
context: .devcontainer
push: true
# Build an image usable as cache-from, per: https://docs.docker.com/engine/reference/commandline/build/#specifying-external-cache-sources
build-args: BUILDKIT_INLINE_CACHE=1
tags: |
docker.pkg.github.com/${{ github.repository }}/devcontainer:latest
docker.pkg.github.com/${{ github.repository }}/devcontainer:${{ github.sha }}