This repository was archived by the owner on Nov 11, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 2
65 lines (54 loc) · 1.9 KB
/
devcontainer.yml
File metadata and controls
65 lines (54 loc) · 1.9 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
name: devcontainer
on:
workflow_dispatch:
inputs:
docker_tag:
description: Descriptive name of the devcontainer for the Docker tag
required: true
type: string
release:
types: [published]
jobs:
build-and-push:
runs-on: ubuntu-latest-4-cores
env:
DOCKER_TAG: latest
steps:
- name: Checkout repository
uses: actions/checkout@v2
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1
- name: Login to GitHub Container Registry
uses: docker/login-action@v1
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Set Docker tag for release event
if: github.event_name == 'release'
run: |
echo "DOCKER_TAG=${{ github.event.release.tag_name }}" >> $GITHUB_ENV
echo "tag_name=$DOCKER_TAG" >> $GITHUB_OUTPUT
- name: Set Docker tag for push event
if: github.event_name == 'push'
run: |
SHORT_SHA=$(echo "${{ github.sha }}" | cut -c 1-7)
echo "DOCKER_TAG=$SHORT_SHA" >> $GITHUB_ENV
- name: Set Docker tag for workflow_dispatch event
if: github.event_name == 'workflow_dispatch'
run: |
echo "DOCKER_TAG=${{ inputs.docker_tag }}" >> $GITHUB_ENV
- name: Set outputs
id: release_info
run: |
echo "tag_name=${{ env.DOCKER_TAG }}" >> $GITHUB_OUTPUT
- name: Build and push Docker image
uses: docker/build-push-action@v2
with:
push: true
file: .devcontainer/Dockerfile
tags: ghcr.io/${{ github.repository }}-dev:latest,ghcr.io/${{ github.repository }}-dev:${{ env.DOCKER_TAG }}
build-args: |
VARIANT=bookworm
platforms: linux/amd64,linux/arm64
cache-from: type=registry,ref=ghcr.io/${{ github.repository }}-dev:latest