Skip to content

Commit 2fb8418

Browse files
feat: build and publish local-artifact-mirror image (#691)
build and publish local-artifact-mirror image.
1 parent c5e0dd3 commit 2fb8418

File tree

5 files changed

+83
-0
lines changed

5 files changed

+83
-0
lines changed

.github/workflows/pull-request.yaml

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,24 @@ jobs:
5050
uses: actions/setup-go@v5
5151
with:
5252
go-version-file: go.mod
53+
54+
- name: Set up Docker Buildx
55+
uses: docker/setup-buildx-action@v2
56+
57+
- name: Login to Registry
58+
uses: docker/login-action@v2
59+
with:
60+
registry: registry.staging.replicated.com
61+
username: ${{ secrets.REGISTRY_USERNAME_STAGING }}
62+
password: ${{ secrets.REGISTRY_PASSWORD_STAGING }}
63+
64+
- name: Build and push local-artifact-mirror image
65+
run: |
66+
export SHORT_SHA=dev-$(git rev-parse --short=7 HEAD)
67+
export LOCAL_ARTIFACT_MIRROR_IMAGE=registry.staging.replicated.com/library/embedded-cluster-local-artifact-mirror:${SHORT_SHA}
68+
make local-artifact-mirror-image
69+
docker push ${LOCAL_ARTIFACT_MIRROR_IMAGE}
70+
5371
- name: Build Linux AMD64 and Output Metadata
5472
run: |
5573
export SHORT_SHA=dev-$(git rev-parse --short=7 HEAD)

.github/workflows/release-dev.yaml

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,24 @@ jobs:
1717
uses: actions/setup-go@v5
1818
with:
1919
go-version-file: go.mod
20+
21+
- name: Set up Docker Buildx
22+
uses: docker/setup-buildx-action@v2
23+
24+
- name: Login to Registry
25+
uses: docker/login-action@v2
26+
with:
27+
registry: registry.staging.replicated.com
28+
username: ${{ secrets.REGISTRY_USERNAME_STAGING }}
29+
password: ${{ secrets.REGISTRY_PASSWORD_STAGING }}
30+
31+
- name: Build and push local-artifact-mirror image
32+
run: |
33+
export SHORT_SHA=dev-$(git rev-parse --short=7 HEAD)
34+
export LOCAL_ARTIFACT_MIRROR_IMAGE=registry.staging.replicated.com/library/embedded-cluster-local-artifact-mirror:${SHORT_SHA}
35+
make local-artifact-mirror-image
36+
docker push ${LOCAL_ARTIFACT_MIRROR_IMAGE}
37+
2038
- name: Build Linux AMD64 and Output Metadata
2139
run: |
2240
export SHORT_SHA=dev-$(git rev-parse --short=7 HEAD)

.github/workflows/release-prod.yaml

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,36 @@ jobs:
2525
uses: actions/setup-go@v5
2626
with:
2727
go-version-file: go.mod
28+
29+
- name: Set up Docker Buildx
30+
uses: docker/setup-buildx-action@v2
31+
32+
- name: Login to Registry
33+
uses: docker/login-action@v2
34+
with:
35+
registry: registry.replicated.com
36+
username: ${{ secrets.REGISTRY_USERNAME_PRODUCTION }}
37+
password: ${{ secrets.REGISTRY_PASSWORD_PRODUCTION }}
38+
39+
- name: Build and push local-artifact-mirror image (production)
40+
run: |
41+
export LOCAL_ARTIFACT_MIRROR_IMAGE=registry.replicated.com/library/embedded-cluster-local-artifact-mirror:${TAG_NAME}
42+
make local-artifact-mirror-image
43+
docker push ${LOCAL_ARTIFACT_MIRROR_IMAGE}
44+
45+
- name: Login to Registry
46+
uses: docker/login-action@v2
47+
with:
48+
registry: registry.staging.replicated.com
49+
username: ${{ secrets.REGISTRY_USERNAME_STAGING }}
50+
password: ${{ secrets.REGISTRY_PASSWORD_STAGING }}
51+
52+
- name: Build and push local-artifact-mirror image (staging)
53+
run: |
54+
export LOCAL_ARTIFACT_MIRROR_IMAGE=registry.staging.replicated.com/library/embedded-cluster-local-artifact-mirror:${TAG_NAME}
55+
make local-artifact-mirror-image
56+
docker push ${LOCAL_ARTIFACT_MIRROR_IMAGE}
57+
2858
- name: Build linux-amd64
2959
run: |
3060
make embedded-cluster-linux-amd64 VERSION=$TAG_NAME

Dockerfile

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
# this dockerfile builds an image containing the local-artifact-mirror binary
2+
# installed on /usr/local/bin/local-artifact-mirror.
3+
FROM golang:1.22 AS builder
4+
WORKDIR /src
5+
COPY go.mod go.sum ./
6+
RUN go mod download
7+
COPY . .
8+
RUN make pkg/goods/bins/local-artifact-mirror
9+
10+
FROM cgr.dev/chainguard/wolfi-base:latest
11+
COPY --from=builder /src/pkg/goods/bins/local-artifact-mirror /usr/local/bin/local-artifact-mirror
12+
ENTRYPOINT ["/usr/local/bin/local-artifact-mirror"]

Makefile

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ K0S_BINARY_SOURCE_OVERRIDE =
3535
TROUBLESHOOT_VERSION = v0.92.1
3636
KOTS_VERSION = v$(shell echo $(ADMIN_CONSOLE_CHART_VERSION) | sed 's/\([0-9]\+\.[0-9]\+\.[0-9]\+\).*/\1/')
3737
KOTS_BINARY_URL_OVERRIDE =
38+
LOCAL_ARTIFACT_MIRROR_IMAGE ?= ttl.sh/$(shell whoami)/embedded-cluster-local-artifact-mirror:24h
3839
LD_FLAGS = -X github.com/replicatedhq/embedded-cluster/pkg/defaults.K0sVersion=$(K0S_VERSION) \
3940
-X github.com/replicatedhq/embedded-cluster/pkg/defaults.Version=$(VERSION) \
4041
-X github.com/replicatedhq/embedded-cluster/pkg/defaults.K0sBinaryURL=$(K0S_BINARY_SOURCE_OVERRIDE) \
@@ -192,3 +193,7 @@ scan:
192193

193194
print-%:
194195
@echo -n $($*)
196+
197+
.PHONY: local-artifact-mirror-image
198+
local-artifact-mirror-image:
199+
docker build -t $(LOCAL_ARTIFACT_MIRROR_IMAGE) -f Dockerfile .

0 commit comments

Comments
 (0)