mirror of
https://github.com/project-zot/zot.git
synced 2024-12-16 21:56:37 -05:00
ci/cd: build for arm64 arch
Signed-off-by: Ramkumar Chinchani <rchincha@cisco.com>
This commit is contained in:
parent
e42e42a2cc
commit
304a68334e
7 changed files with 92 additions and 7 deletions
17
.github/workflows/ci-cd.yml
vendored
17
.github/workflows/ci-cd.yml
vendored
|
@ -91,3 +91,20 @@ jobs:
|
||||||
tags: |
|
tags: |
|
||||||
ghcr.io/${{ github.repository }}-minimal:${{ github.event.release.tag_name }}
|
ghcr.io/${{ github.repository }}-minimal:${{ github.event.release.tag_name }}
|
||||||
ghcr.io/${{ github.repository }}-minimal:latest
|
ghcr.io/${{ github.repository }}-minimal:latest
|
||||||
|
- name: Build container image (arm64)
|
||||||
|
uses: docker/build-push-action@v2
|
||||||
|
with:
|
||||||
|
build-args: ARCH=arm64
|
||||||
|
push: true
|
||||||
|
tags: |
|
||||||
|
ghcr.io/${{ github.repository }}-arm64:${{ github.event.release.tag_name }}
|
||||||
|
ghcr.io/${{ github.repository }}-arm64:latest
|
||||||
|
- name: Build minimal container image (arm64)
|
||||||
|
uses: docker/build-push-action@v2
|
||||||
|
with:
|
||||||
|
build-args: ARCH=arm64
|
||||||
|
push: true
|
||||||
|
file: Dockerfile-minimal
|
||||||
|
tags: |
|
||||||
|
ghcr.io/${{ github.repository }}-arm64-minimal:${{ github.event.release.tag_name }}
|
||||||
|
ghcr.io/${{ github.repository }}-arm64-minimal:latest
|
||||||
|
|
|
@ -5,7 +5,7 @@ FROM docker.io/golang:1.16 AS builder
|
||||||
RUN mkdir -p /go/src/github.com/anuvu/zot
|
RUN mkdir -p /go/src/github.com/anuvu/zot
|
||||||
WORKDIR /go/src/github.com/anuvu/zot
|
WORKDIR /go/src/github.com/anuvu/zot
|
||||||
COPY . .
|
COPY . .
|
||||||
RUN CGO_ENABLED=0 make clean binary
|
RUN make clean binary
|
||||||
RUN echo '{\n\
|
RUN echo '{\n\
|
||||||
"storage": {\n\
|
"storage": {\n\
|
||||||
"rootDirectory": "/var/lib/registry"\n\
|
"rootDirectory": "/var/lib/registry"\n\
|
||||||
|
|
33
Dockerfile-arch
Normal file
33
Dockerfile-arch
Normal file
|
@ -0,0 +1,33 @@
|
||||||
|
# ---
|
||||||
|
# Stage 1: Install certs, build binary, create default config file
|
||||||
|
# ---
|
||||||
|
FROM docker.io/golang:1.16 AS builder
|
||||||
|
ARG ARCH
|
||||||
|
RUN mkdir -p /go/src/github.com/anuvu/zot
|
||||||
|
WORKDIR /go/src/github.com/anuvu/zot
|
||||||
|
COPY . .
|
||||||
|
RUN make ARCH=$ARCH clean binary
|
||||||
|
RUN echo '{\n\
|
||||||
|
"storage": {\n\
|
||||||
|
"rootDirectory": "/var/lib/registry"\n\
|
||||||
|
},\n\
|
||||||
|
"http": {\n\
|
||||||
|
"address": "0.0.0.0",\n\
|
||||||
|
"port": "5000"\n\
|
||||||
|
},\n\
|
||||||
|
"log": {\n\
|
||||||
|
"level": "debug"\n\
|
||||||
|
}\n\
|
||||||
|
}\n' > config.json && cat config.json
|
||||||
|
|
||||||
|
# ---
|
||||||
|
# Stage 2: Final image with nothing but certs, binary, and default config file
|
||||||
|
# ---
|
||||||
|
FROM scratch AS final
|
||||||
|
COPY --from=builder /etc/ssl/certs/ca-certificates.crt /etc/ssl/certs/ca-certificates.crt
|
||||||
|
COPY --from=builder /go/src/github.com/anuvu/zot/bin/zot /usr/bin/zot
|
||||||
|
COPY --from=builder /go/src/github.com/anuvu/zot/config.json /etc/zot/config.json
|
||||||
|
ENTRYPOINT ["/usr/bin/zot"]
|
||||||
|
EXPOSE 5000
|
||||||
|
VOLUME ["/var/lib/registry"]
|
||||||
|
CMD ["serve", "/etc/zot/config.json"]
|
33
Dockerfile-arch-minimal
Normal file
33
Dockerfile-arch-minimal
Normal file
|
@ -0,0 +1,33 @@
|
||||||
|
# ---
|
||||||
|
# Stage 1: Install certs, build binary, create default config file
|
||||||
|
# ---
|
||||||
|
FROM docker.io/golang:1.16 AS builder
|
||||||
|
ARG ARCH
|
||||||
|
RUN mkdir -p /go/src/github.com/anuvu/zot
|
||||||
|
WORKDIR /go/src/github.com/anuvu/zot
|
||||||
|
COPY . .
|
||||||
|
RUN make ARCH=$ARCH clean binary-minimal
|
||||||
|
RUN echo '{\n\
|
||||||
|
"storage": {\n\
|
||||||
|
"rootDirectory": "/var/lib/registry"\n\
|
||||||
|
},\n\
|
||||||
|
"http": {\n\
|
||||||
|
"address": "0.0.0.0",\n\
|
||||||
|
"port": "5000"\n\
|
||||||
|
},\n\
|
||||||
|
"log": {\n\
|
||||||
|
"level": "debug"\n\
|
||||||
|
}\n\
|
||||||
|
}\n' > config.json && cat config.json
|
||||||
|
|
||||||
|
# ---
|
||||||
|
# Stage 2: Final image with nothing but certs, binary, and default config file
|
||||||
|
# ---
|
||||||
|
FROM scratch AS final
|
||||||
|
COPY --from=builder /etc/ssl/certs/ca-certificates.crt /etc/ssl/certs/ca-certificates.crt
|
||||||
|
COPY --from=builder /go/src/github.com/anuvu/zot/bin/zot-minimal /usr/bin/zot
|
||||||
|
COPY --from=builder /go/src/github.com/anuvu/zot/config.json /etc/zot/config.json
|
||||||
|
ENTRYPOINT ["/usr/bin/zot"]
|
||||||
|
EXPOSE 5000
|
||||||
|
VOLUME ["/var/lib/registry"]
|
||||||
|
CMD ["serve", "/etc/zot/config.json"]
|
|
@ -6,7 +6,7 @@ RUN apk --update add git make ca-certificates
|
||||||
RUN mkdir -p /go/src/github.com/anuvu/zot
|
RUN mkdir -p /go/src/github.com/anuvu/zot
|
||||||
WORKDIR /go/src/github.com/anuvu/zot
|
WORKDIR /go/src/github.com/anuvu/zot
|
||||||
COPY . .
|
COPY . .
|
||||||
RUN CGO_ENABLED=0 make clean binary
|
RUN make clean binary
|
||||||
RUN echo -e '# Default config file for zot server\n\
|
RUN echo -e '# Default config file for zot server\n\
|
||||||
http:\n\
|
http:\n\
|
||||||
address: 0.0.0.0\n\
|
address: 0.0.0.0\n\
|
||||||
|
|
|
@ -5,7 +5,7 @@ FROM docker.io/golang:1.16 AS builder
|
||||||
RUN mkdir -p /go/src/github.com/anuvu/zot
|
RUN mkdir -p /go/src/github.com/anuvu/zot
|
||||||
WORKDIR /go/src/github.com/anuvu/zot
|
WORKDIR /go/src/github.com/anuvu/zot
|
||||||
COPY . .
|
COPY . .
|
||||||
RUN CGO_ENABLED=0 make clean binary-minimal
|
RUN make clean binary-minimal
|
||||||
RUN echo '{\n\
|
RUN echo '{\n\
|
||||||
"storage": {\n\
|
"storage": {\n\
|
||||||
"rootDirectory": "/var/lib/registry"\n\
|
"rootDirectory": "/var/lib/registry"\n\
|
||||||
|
|
10
Makefile
10
Makefile
|
@ -7,25 +7,27 @@ CONTAINER_RUNTIME := $(shell command -v podman 2> /dev/null || echo docker)
|
||||||
PATH := bin:$(PATH)
|
PATH := bin:$(PATH)
|
||||||
TMPDIR := $(shell mktemp -d)
|
TMPDIR := $(shell mktemp -d)
|
||||||
STACKER := $(shell which stacker)
|
STACKER := $(shell which stacker)
|
||||||
|
OS ?= linux
|
||||||
|
ARCH ?= amd64
|
||||||
|
|
||||||
.PHONY: all
|
.PHONY: all
|
||||||
all: swagger binary binary-minimal exporter-minimal debug test test-clean check
|
all: swagger binary binary-minimal exporter-minimal debug test test-clean check
|
||||||
|
|
||||||
.PHONY: binary-minimal
|
.PHONY: binary-minimal
|
||||||
binary-minimal: swagger
|
binary-minimal: swagger
|
||||||
go build -o bin/zot-minimal -tags minimal,containers_image_openpgp -v -trimpath -ldflags "-X github.com/anuvu/zot/pkg/api/config.Commit=${COMMIT} -X github.com/anuvu/zot/pkg/api/config.BinaryType=minimal -X github.com/anuvu/zot/pkg/api/config.GoVersion=${GO_VERSION}" ./cmd/zot
|
env CGO_ENABLED=0 GOOS=$(OS) GOARCH=$(ARCH) go build -o bin/zot-minimal -tags minimal,containers_image_openpgp -v -trimpath -ldflags "-X github.com/anuvu/zot/pkg/api/config.Commit=${COMMIT} -X github.com/anuvu/zot/pkg/api/config.BinaryType=minimal -X github.com/anuvu/zot/pkg/api/config.GoVersion=${GO_VERSION} -s -w" ./cmd/zot
|
||||||
|
|
||||||
.PHONY: binary
|
.PHONY: binary
|
||||||
binary: swagger
|
binary: swagger
|
||||||
go build -o bin/zot -tags extended,containers_image_openpgp -v -trimpath -ldflags "-X github.com/anuvu/zot/pkg/api/config.Commit=${COMMIT} -X github.com/anuvu/zot/pkg/api/config.BinaryType=extended -X github.com/anuvu/zot/pkg/api/config.GoVersion=${GO_VERSION}" ./cmd/zot
|
env CGO_ENABLED=0 GOOS=$(OS) GOARCH=$(ARCH) go build -o bin/zot -tags extended,containers_image_openpgp -v -trimpath -ldflags "-X github.com/anuvu/zot/pkg/api/config.Commit=${COMMIT} -X github.com/anuvu/zot/pkg/api/config.BinaryType=extended -X github.com/anuvu/zot/pkg/api/config.GoVersion=${GO_VERSION} -s -w" ./cmd/zot
|
||||||
|
|
||||||
.PHONY: debug
|
.PHONY: debug
|
||||||
debug: swagger
|
debug: swagger
|
||||||
go build -o bin/zot-debug -tags extended,containers_image_openpgp -v -gcflags all='-N -l' -ldflags "-X github.com/anuvu/zot/pkg/api/config.Commit=${COMMIT} -X github.com/anuvu/zot/pkg/api/config.BinaryType=extended -X github.com/anuvu/zot/pkg/api/config.GoVersion=${GO_VERSION}" ./cmd/zot
|
env CGO_ENABLED=0 GOOS=$(OS) GOARCH=$(ARCH) go build -o bin/zot-debug -tags extended,containers_image_openpgp -v -gcflags all='-N -l' -ldflags "-X github.com/anuvu/zot/pkg/api/config.Commit=${COMMIT} -X github.com/anuvu/zot/pkg/api/config.BinaryType=extended -X github.com/anuvu/zot/pkg/api/config.GoVersion=${GO_VERSION}" ./cmd/zot
|
||||||
|
|
||||||
.PHONY: exporter-minimal
|
.PHONY: exporter-minimal
|
||||||
exporter-minimal: swagger
|
exporter-minimal: swagger
|
||||||
go build -o bin/zot-exporter -tags minimal,containers_image_openpgp -v -trimpath ./cmd/exporter
|
env CGO_ENABLED=0 GOOS=$(OS) GOARCH=$(ARCH) go build -o bin/zot-exporter -tags minimal,containers_image_openpgp -v -trimpath ./cmd/exporter
|
||||||
|
|
||||||
.PHONY: test
|
.PHONY: test
|
||||||
test:
|
test:
|
||||||
|
|
Loading…
Reference in a new issue