-
Notifications
You must be signed in to change notification settings - Fork 1
49 lines (41 loc) · 1.16 KB
/
push.yml
File metadata and controls
49 lines (41 loc) · 1.16 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
name: Build image on push
on:
push:
branches: [ main ]
workflow_dispatch:
permissions:
contents: read
packages: write
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Make IMAGE_BASE
id: image_base
env:
REPO: ${{ github.repository }}
run: echo "IMAGE_BASE=ghcr.io/${REPO,,}" >> $GITHUB_ENV && echo $IMAGE_BASE
- name: Login to GHCR
uses: docker/login-action@v2
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Set up QEMU (optional)
uses: docker/setup-qemu-action@v3
- name: Set up buildx
uses: docker/setup-buildx-action@v3
- name: Build and push SHA-tag image
id: build
uses: docker/build-push-action@v4
with:
context: .
file: ./.devcontainer/Dockerfile
push: true
build-args: |
GITHUB_REPOSITORY=${{ github.repository }}
tags: |
${{ env.IMAGE_BASE }}:${{ github.sha }}
${{ env.IMAGE_BASE }}:latest