fix: run staging registry with --network host so 127.0.0.1:5000 is reachable from both buildx and regctl
Some checks failed
Docker / build (push) Has been cancelled
Some checks failed
Docker / build (push) Has been cancelled
This commit is contained in:
@@ -10,6 +10,7 @@ on:
|
||||
env:
|
||||
REGISTRY: git.govekar.net
|
||||
IMAGE: lovrog05/localmodelroutex
|
||||
LOCAL_REG: 127.0.0.1:5000
|
||||
|
||||
jobs:
|
||||
build:
|
||||
@@ -43,16 +44,30 @@ jobs:
|
||||
- name: Set up QEMU
|
||||
uses: docker/setup-qemu-action@v3
|
||||
|
||||
# Start the staging registry on the host loopback BEFORE buildx so the
|
||||
# config-inline below can reference a stable address.
|
||||
- name: Start local registry
|
||||
run: |
|
||||
docker rm -f local-registry 2>/dev/null || true
|
||||
docker run -d --network host --name local-registry registry:2
|
||||
|
||||
# BuildKit runs with host networking so it can reach 127.0.0.1:5000.
|
||||
# config-inline tells it to use plain HTTP for that address.
|
||||
- name: Set up Docker Buildx
|
||||
uses: docker/setup-buildx-action@v3
|
||||
with:
|
||||
driver-opts: network=host
|
||||
config-inline: |
|
||||
[registry."127.0.0.1:5000"]
|
||||
http = true
|
||||
|
||||
- name: Build standard image
|
||||
uses: docker/build-push-action@v6
|
||||
with:
|
||||
context: .
|
||||
file: Dockerfile
|
||||
push: false
|
||||
outputs: type=oci,dest=/tmp/lmr-standard.tar
|
||||
push: true
|
||||
tags: ${{ env.LOCAL_REG }}/lmr:standard
|
||||
labels: ${{ steps.meta.outputs.labels }}
|
||||
platforms: linux/amd64,linux/arm64
|
||||
provenance: false
|
||||
@@ -62,8 +77,8 @@ jobs:
|
||||
with:
|
||||
context: .
|
||||
file: Dockerfile.bundled
|
||||
push: false
|
||||
outputs: type=oci,dest=/tmp/lmr-bundled.tar
|
||||
push: true
|
||||
tags: ${{ env.LOCAL_REG }}/lmr:bundled
|
||||
labels: ${{ steps.meta-bundled.outputs.labels }}
|
||||
platforms: linux/amd64,linux/arm64
|
||||
provenance: false
|
||||
@@ -74,7 +89,6 @@ jobs:
|
||||
curl -sL "https://github.com/regclient/regclient/releases/latest/download/regctl-linux-amd64" \
|
||||
-o /usr/local/bin/regctl
|
||||
chmod +x /usr/local/bin/regctl
|
||||
regctl version
|
||||
|
||||
- name: Configure registry auth
|
||||
if: github.event_name != 'pull_request'
|
||||
@@ -86,8 +100,10 @@ jobs:
|
||||
python3 - <<'EOF'
|
||||
import json, os
|
||||
reg = os.environ["REGISTRY"]
|
||||
local_reg = os.environ["LOCAL_REG"]
|
||||
cfg = {
|
||||
"hosts": {
|
||||
local_reg: {"tls": "disabled"},
|
||||
reg: {
|
||||
"user": os.environ["REGISTRY_USER"],
|
||||
"pass": os.environ["REGISTRY_PASSWORD"],
|
||||
@@ -99,7 +115,7 @@ jobs:
|
||||
path = os.path.expanduser("~/.regctl/config.json")
|
||||
with open(path, "w") as f:
|
||||
json.dump(cfg, f)
|
||||
print(f"Wrote regctl config for {reg}")
|
||||
print(f"Wrote regctl config for {reg} (local staging: {local_reg})")
|
||||
EOF
|
||||
|
||||
- name: Push standard image
|
||||
@@ -107,11 +123,9 @@ jobs:
|
||||
env:
|
||||
TAGS: ${{ steps.meta.outputs.tags }}
|
||||
run: |
|
||||
mkdir -p /tmp/oci/std
|
||||
tar -xf /tmp/lmr-standard.tar -C /tmp/oci/std
|
||||
echo "$TAGS" | while IFS= read -r tag; do
|
||||
[ -z "$tag" ] && continue
|
||||
(cd / && regctl image copy "ocidir:tmp/oci/std" "$tag")
|
||||
regctl image copy "$LOCAL_REG/lmr:standard" "$tag"
|
||||
done
|
||||
|
||||
- name: Push bundled image
|
||||
@@ -119,9 +133,7 @@ jobs:
|
||||
env:
|
||||
TAGS: ${{ steps.meta-bundled.outputs.tags }}
|
||||
run: |
|
||||
mkdir -p /tmp/oci/bnd
|
||||
tar -xf /tmp/lmr-bundled.tar -C /tmp/oci/bnd
|
||||
echo "$TAGS" | while IFS= read -r tag; do
|
||||
[ -z "$tag" ] && continue
|
||||
(cd / && regctl image copy "ocidir:tmp/oci/bnd" "$tag")
|
||||
regctl image copy "$LOCAL_REG/lmr:bundled" "$tag"
|
||||
done
|
||||
|
||||
Reference in New Issue
Block a user