From 8e00c96a85e2279d3230306295efea092769f8fe Mon Sep 17 00:00:00 2001 From: reubenmiller Date: Tue, 26 Nov 2024 15:30:11 +0100 Subject: [PATCH] add workflow to publish dev container periodically --- .github/workflows/devcontainer.yml | 41 ++++++++++++++++++++++++++++++ justfile | 17 +++++++++++++ 2 files changed, 58 insertions(+) create mode 100644 .github/workflows/devcontainer.yml diff --git a/.github/workflows/devcontainer.yml b/.github/workflows/devcontainer.yml new file mode 100644 index 00000000000..cad2d83f2e9 --- /dev/null +++ b/.github/workflows/devcontainer.yml @@ -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)" diff --git a/justfile b/justfile index 51880377966..38f6a3bb632 100644 --- a/justfile +++ b/justfile @@ -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: