-
-
Notifications
You must be signed in to change notification settings - Fork 447
68 lines (56 loc) · 1.97 KB
/
build-docker.yml
File metadata and controls
68 lines (56 loc) · 1.97 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
66
67
68
name: Build Docker
on:
workflow_dispatch: {}
workflow_call: {}
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
build-docker:
runs-on: ubuntu-latest
permissions:
contents: read
packages: write # required for GHCR pushes
env:
REGISTRY: ghcr.io
IMAGE_NAME: ghcr.io/${{ github.repository }}
BASE_IMAGE: ghcr.io/${{ github.repository_owner }}/lncrawl-base:latest
steps:
- name: 📥 Checkout
uses: actions/checkout@v6
with:
submodules: recursive
- name: 🔧 Set lowercase image name
run: |
echo "IMAGE_NAME=ghcr.io/${GITHUB_REPOSITORY,,}" >> $GITHUB_ENV
echo "BASE_IMAGE=ghcr.io/${GITHUB_REPOSITORY_OWNER,,}/lncrawl-base:latest" >> $GITHUB_ENV
- name: 🤖 Set up QEMU
uses: docker/setup-qemu-action@v4
- name: 🐳 Set up Docker Buildx
uses: docker/setup-buildx-action@v4
- name: 🔐 Login to GHCR
uses: docker/login-action@v4
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: 🏷️ Read package version
id: package_version
run: echo "version=$(head -n 1 lncrawl/VERSION)" >> "$GITHUB_OUTPUT"
- name: 🏗️ Build and Push Image
uses: docker/build-push-action@v6
with:
context: .
platforms: linux/amd64,linux/arm64
push: true
build-args: |
BASE_IMAGE=${{ env.BASE_IMAGE }}
tags: |
${{ env.IMAGE_NAME }}:latest
${{ env.IMAGE_NAME }}:${{ github.sha }}
${{ env.IMAGE_NAME }}:${{ steps.package_version.outputs.version }}
labels: |
org.opencontainers.image.source=${{ github.event.repository.html_url }}
org.opencontainers.image.revision=${{ github.sha }}
cache-from: type=gha
cache-to: type=gha,mode=max