-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathjustfile
More file actions
54 lines (43 loc) · 3.02 KB
/
Copy pathjustfile
File metadata and controls
54 lines (43 loc) · 3.02 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
set shell := ["bash", "-euo", "pipefail", "-c"]
import "hack/tools.just"
# Print list of available recipes
default:
@just --list
# build everything
all: build && version
oci_repo := "127.0.0.1:30000"
oci_prefix := "githedgehog/host-bgp"
oci_fabricator_prefix := "githedgehog/fabricator"
# Platforms for the multi-arch standard image manifest
platforms := "linux/amd64,linux/arm64"
# Dedicated buildx builder. Multi-platform builds and OCI/docker archive exports
# require the docker-container driver; the default "docker" driver supports
# neither ("OCI exporter is not supported for the docker driver"). The buildkit
# image bundles QEMU emulators, so cross-arch builds work without host binfmt.
buildx_builder := "host-bgp-builder"
_buildx:
docker buildx inspect {{buildx_builder}} >/dev/null 2>&1 || docker buildx create --name {{buildx_builder}} --driver docker-container --bootstrap
# Build the amd64 image into the local daemon (local dev convenience).
# Multi-arch images can't live in the daemon, so the published standard image is
# built to an OCI archive and pushed with skopeo by the push-* recipes below.
build: _buildx
docker buildx build --builder {{buildx_builder}} --load --platform=linux/amd64 -t {{oci_repo}}/{{oci_prefix}}:{{version}} -f Dockerfile .
# Push only the latest tag (for master branch)
# The standard image is a multi-arch (amd64+arm64) manifest: buildx writes it to a
# local OCI archive and skopeo copies the whole manifest list (--all) to the
# registry. The fabricator oras tarball stays amd64-only (docker-archive can't
# hold multiple platforms) and is exported directly by buildx (type=docker == the
# docker-save format).
push-latest: _buildx _skopeo _oras && version
docker buildx build --builder {{buildx_builder}} --platform={{platforms}} --output type=oci,dest=host-bgp-oci.tar -t {{oci_repo}}/{{oci_prefix}}:latest -f Dockerfile .
{{skopeo}} --insecure-policy copy --all {{skopeo_copy_flags}} {{skopeo_dest_insecure}} oci-archive:host-bgp-oci.tar docker://{{oci_repo}}/{{oci_prefix}}:latest
docker buildx build --builder {{buildx_builder}} --platform=linux/amd64 --output type=docker,dest=host-bgp.tar -t {{oci_repo}}/{{oci_prefix}}:latest -f Dockerfile .
{{oras}} push {{oras_insecure}} {{oci_repo}}/{{oci_fabricator_prefix}}/host-bgp:latest host-bgp.tar
# Push only the versioned tag (for tag pushes)
push-versioned: _buildx _skopeo _oras && version
docker buildx build --builder {{buildx_builder}} --platform={{platforms}} --output type=oci,dest=host-bgp-oci.tar -t {{oci_repo}}/{{oci_prefix}}:{{version}} -f Dockerfile .
{{skopeo}} --insecure-policy copy --all {{skopeo_copy_flags}} {{skopeo_dest_insecure}} oci-archive:host-bgp-oci.tar docker://{{oci_repo}}/{{oci_prefix}}:{{version}}
docker buildx build --builder {{buildx_builder}} --platform=linux/amd64 --output type=docker,dest=host-bgp.tar -t {{oci_repo}}/{{oci_prefix}}:{{version}} -f Dockerfile .
{{oras}} push {{oras_insecure}} {{oci_repo}}/{{oci_fabricator_prefix}}/host-bgp:{{version}} host-bgp.tar
# Alias for push-versioned
push: push-versioned