Skip to content

Commit

Permalink
add workflow to publish dev container periodically
Browse files Browse the repository at this point in the history
  • Loading branch information
reubenmiller committed Nov 26, 2024
1 parent dff88d2 commit 8e00c96
Show file tree
Hide file tree
Showing 2 changed files with 58 additions and 0 deletions.
41 changes: 41 additions & 0 deletions .github/workflows/devcontainer.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
name: devcontainer

on:
# trigger manually
workflow_dispatch:

# run automatically once a month to update
# any changes in the base image
schedule:
- cron: "0 1 1 * *"

# update on changes
push:
paths:
- '.devcontainer/**'

jobs:
publish:
runs-on: ubuntu-latest
permissions:
contents: read
packages: write

steps:
- uses: actions/checkout@v4

- name: Setup Docker buildx
uses: docker/setup-buildx-action@v3
with:
install: true

- name: Login to GitHub Container Registry
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- uses: taiki-e/install-action@just
- name: Publish
run: just publish-dev-container "$(date +%Y%m%d)"
17 changes: 17 additions & 0 deletions justfile
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,23 @@ info:
version TYPE="all":
@./ci/build_scripts/version.sh {{TYPE}} 2>/dev/null || exit 0

# Publish the dev container to provide more reproducible dev environments
#
# docker login ghcr.io
publish-dev-container TAG="latest" IMAGE="ghcr.io/thin-edge/devcontainer" VARIANT="bookworm" OUTPUT_TYPE="registry":
docker buildx install
cd .devcontainer && docker buildx build \
--platform linux/amd64,linux/arm64,linux/arm/7 \
--build-arg "VARIANT={{VARIANT}}" \
--label "org.opencontainers.image.version={{VERSION}}-{{VARIANT}}" \
--label "org.opencontainers.image.source=https://github.com/thin-edge/thin-edge.io" \
-t "{{IMAGE}}:{{TAG}}-{{VARIANT}}" \
-t "{{IMAGE}}:latest-{{VARIANT}}" \
-f Dockerfile \
--output=type="{{OUTPUT_TYPE}}",oci-mediatypes=false \
--provenance=false \
.

# Default recipe
[private]
default:
Expand Down

0 comments on commit 8e00c96

Please sign in to comment.