diff options
author | Hauke Mehrtens <hauke@hauke-m.de> | 2024-01-27 15:17:10 +0100 |
---|---|---|
committer | Hauke Mehrtens <hauke@hauke-m.de> | 2024-01-27 18:56:39 +0100 |
commit | 9524b9e5bace7585aa607f1439fe2e3300efa795 (patch) | |
tree | 68876bdeca5f239bf97c973087821edf0c7b2ad6 | |
parent | 3952ac9f0b6b22e8324dd6b53feb447b197af782 (diff) | |
download | backports-9524b9e5bace7585aa607f1439fe2e3300efa795.tar.gz |
CI: Create github action to publish dev container
This github action will build the development container and publish the
artifacts to the github docker registry. This allows others to easily
use this container and creates it in a standardized way.
Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
-rw-r--r-- | .github/workflows/build_publish_container.yml | 46 |
1 files changed, 46 insertions, 0 deletions
diff --git a/.github/workflows/build_publish_container.yml b/.github/workflows/build_publish_container.yml new file mode 100644 index 00000000..a8309455 --- /dev/null +++ b/.github/workflows/build_publish_container.yml @@ -0,0 +1,46 @@ +name: Build and publish dev container + +on: + workflow_dispatch: + push: + tags: + - 'v*' + +env: + REGISTRY: ghcr.io + IMAGE_NAME: ${{ github.repository }} + +jobs: + push_to_registry: + name: push to registry + runs-on: ubuntu-latest + + permissions: + contents: read + packages: write + + steps: + - name: Check out the repo + uses: actions/checkout@v4 + + - name: Log in to github Docker registry + uses: docker/login-action@v3 + with: + registry: ${{ env.REGISTRY }} + username: ${{ github.actor }} + password: ${{ secrets.GITHUB_TOKEN }} + + - name: Extract metadata (tags, labels) for Docker + id: meta + uses: docker/metadata-action@v5 + with: + images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }} + + - 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 }} |