mirror of
https://github.com/project-zot/zot.git
synced 2024-12-16 21:56:37 -05:00
build: parameterize arch builds
Build zot artifacts for multiple os and arch. [linux, amd64] - common case [linux, arm64] - raspberry pi [darwin, amd64] - Intel-based macs [darwin, arm64] - Arm-based macs Signed-off-by: Ramkumar Chinchani <rchincha@cisco.com>
This commit is contained in:
parent
d2aa016cdb
commit
298b966eab
11 changed files with 77 additions and 225 deletions
93
.github/workflows/ci-cd.yml
vendored
93
.github/workflows/ci-cd.yml
vendored
|
@ -13,6 +13,10 @@ jobs:
|
|||
build-test:
|
||||
name: Build and test ZOT
|
||||
runs-on: ubuntu-latest
|
||||
strategy:
|
||||
matrix:
|
||||
os: [linux, darwin]
|
||||
arch: [amd64, arm64]
|
||||
services:
|
||||
s3mock:
|
||||
image: ghcr.io/project-zot/localstack/localstack:0.13.2
|
||||
|
@ -46,11 +50,19 @@ jobs:
|
|||
- name: Run build and test
|
||||
timeout-minutes: 60
|
||||
run: |
|
||||
cd $GITHUB_WORKSPACE && make && make ARCH=arm64 binary-arch-minimal && make ARCH=arm64 binary-arch
|
||||
echo "Building for $OS:$ARCH"
|
||||
cd $GITHUB_WORKSPACE
|
||||
if [ "${OS}" == "linux" && "${ARCH}" == "amd64" ]; then
|
||||
make OS=$OS ARCH=$ARCH
|
||||
else
|
||||
make OS=$OS ARCH=$ARCH binary binary-minimal binary-debug cli bench exporter-minimal
|
||||
fi
|
||||
env:
|
||||
S3MOCK_ENDPOINT: localhost:4566
|
||||
AWS_ACCESS_KEY_ID: fake
|
||||
AWS_SECRET_ACCESS_KEY: fake
|
||||
OS: ${{ matrix.os }}
|
||||
ARCH: ${{ matrix.arch }}
|
||||
|
||||
- name: Upload code coverage
|
||||
uses: codecov/codecov-action@v1
|
||||
|
@ -69,6 +81,10 @@ jobs:
|
|||
if: github.event_name == 'release' && github.event.action== 'published'
|
||||
name: Push Docker image to GitHub Packages
|
||||
runs-on: ubuntu-latest
|
||||
strategy:
|
||||
matrix:
|
||||
os: [linux, darwin]
|
||||
arch: [amd64, arm64]
|
||||
steps:
|
||||
- name: Check out the repo
|
||||
uses: actions/checkout@v2
|
||||
|
@ -78,86 +94,51 @@ jobs:
|
|||
registry: ghcr.io
|
||||
username: ${{ github.actor }}
|
||||
password: ${{ secrets.GITHUB_TOKEN }}
|
||||
- name: Build container image
|
||||
- name: Build zot container image
|
||||
uses: docker/build-push-action@v2
|
||||
with:
|
||||
build-args: |
|
||||
COMMIT=${{ github.event.release.tag_name }}-${{ github.sha }}
|
||||
OS=${{ matrix.os }}
|
||||
ARCH=${{ matrix.arch }}
|
||||
push: true
|
||||
file: Dockerfile
|
||||
tags: |
|
||||
ghcr.io/${{ github.repository }}:${{ github.event.release.tag_name }}
|
||||
ghcr.io/${{ github.repository }}:latest
|
||||
- name: Build minimal container image
|
||||
ghcr.io/${{ github.repository }}-${{ matrix.os }}-${{ matrix.arch }}:${{ github.event.release.tag_name }}
|
||||
ghcr.io/${{ github.repository }}-${{ matrix.os }}-${{ matrix.arch }}:latest
|
||||
- name: Build zot-minimal container image
|
||||
uses: docker/build-push-action@v2
|
||||
with:
|
||||
build-args: |
|
||||
COMMIT=${{ github.event.release.tag_name }}-${{ github.sha }}
|
||||
OS=${{ matrix.os }}
|
||||
ARCH=${{ matrix.arch }}
|
||||
push: true
|
||||
file: Dockerfile-minimal
|
||||
tags: |
|
||||
ghcr.io/${{ github.repository }}-minimal:${{ github.event.release.tag_name }}
|
||||
ghcr.io/${{ github.repository }}-minimal:latest
|
||||
ghcr.io/${{ github.repository }}-minimal-${{ matrix.os }}-${{ matrix.arch }}:${{ github.event.release.tag_name }}
|
||||
ghcr.io/${{ github.repository }}-minimal-${{ matrix.os }}-${{ matrix.arch }}:latest
|
||||
- name: Build zot-exporter container image
|
||||
uses: docker/build-push-action@v2
|
||||
with:
|
||||
build-args: |
|
||||
COMMIT=${{ github.event.release.tag_name }}-${{ github.sha }}
|
||||
OS=${{ matrix.os }}
|
||||
ARCH=${{ matrix.arch }}
|
||||
push: true
|
||||
file: Dockerfile-zxp
|
||||
tags: |
|
||||
ghcr.io/${{ github.repository }}-zxp:${{ github.event.release.tag_name }}
|
||||
ghcr.io/${{ github.repository }}-zxp:latest
|
||||
- name: Build zot-exporter container image (arm64)
|
||||
uses: docker/build-push-action@v2
|
||||
with:
|
||||
build-args: |
|
||||
COMMIT=${{ github.event.release.tag_name }}-${{ github.sha }}
|
||||
ARCH=arm64
|
||||
push: true
|
||||
file: Dockerfile-arch-zxp
|
||||
tags: |
|
||||
ghcr.io/${{ github.repository }}-arm64-zxp:${{ github.event.release.tag_name }}
|
||||
ghcr.io/${{ github.repository }}-arm64-zxp:latest
|
||||
- name: Build container image (arm64)
|
||||
uses: docker/build-push-action@v2
|
||||
with:
|
||||
build-args: |
|
||||
COMMIT=${{ github.event.release.tag_name }}-${{ github.sha }}
|
||||
ARCH=arm64
|
||||
push: true
|
||||
file: Dockerfile-arch
|
||||
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: |
|
||||
COMMIT=${{ github.event.release.tag_name }}-${{ github.sha }}
|
||||
ARCH=arm64
|
||||
push: true
|
||||
file: Dockerfile-arch-minimal
|
||||
tags: |
|
||||
ghcr.io/${{ github.repository }}-arm64-minimal:${{ github.event.release.tag_name }}
|
||||
ghcr.io/${{ github.repository }}-arm64-minimal:latest
|
||||
- name: Build container image
|
||||
ghcr.io/${{ github.repository }}-zxp-${{ matrix.os }}-${{ matrix.arch }}:${{ github.event.release.tag_name }}
|
||||
ghcr.io/${{ github.repository }}-zxp-${{ matrix.os }}-${{ matrix.arch }}:latest
|
||||
- name: Build zb container image
|
||||
uses: docker/build-push-action@v2
|
||||
with:
|
||||
build-args: |
|
||||
COMMIT=${{ github.event.release.tag_name }}-${{ github.sha }}
|
||||
OS=${{ matrix.os }}
|
||||
ARCH=${{ matrix.arch }}
|
||||
push: true
|
||||
file: Dockerfile-zb
|
||||
tags: |
|
||||
ghcr.io/${{ github.repository }}:${{ github.event.release.tag_name }}
|
||||
ghcr.io/${{ github.repository }}:latest
|
||||
- name: Build container image (arm64)
|
||||
uses: docker/build-push-action@v2
|
||||
with:
|
||||
build-args: |
|
||||
COMMIT=${{ github.event.release.tag_name }}-${{ github.sha }}
|
||||
ARCH=arm64
|
||||
push: true
|
||||
file: Dockerfile-arch-zb
|
||||
tags: |
|
||||
ghcr.io/${{ github.repository }}-arm64:${{ github.event.release.tag_name }}
|
||||
ghcr.io/${{ github.repository }}-arm64:latest
|
||||
ghcr.io/${{ github.repository }}-zb-${{ matrix.os }}-${{ matrix.arch }}:${{ github.event.release.tag_name }}
|
||||
ghcr.io/${{ github.repository }}-zb-${{ matrix.os }}-${{ matrix.arch }}:latest
|
||||
|
|
|
@ -3,10 +3,12 @@
|
|||
# ---
|
||||
FROM ghcr.io/project-zot/golang:1.17 AS builder
|
||||
ARG COMMIT
|
||||
ARG OS
|
||||
ARG ARCH
|
||||
RUN mkdir -p /go/src/github.com/project-zot/zot
|
||||
WORKDIR /go/src/github.com/project-zot/zot
|
||||
COPY . .
|
||||
RUN make COMMIT=$COMMIT clean binary
|
||||
RUN make COMMIT=$COMMIT OS=$OS ARCH=$ARCH clean binary
|
||||
RUN echo '{\n\
|
||||
"storage": {\n\
|
||||
"rootDirectory": "/var/lib/registry"\n\
|
||||
|
@ -25,7 +27,7 @@ RUN echo '{\n\
|
|||
# ---
|
||||
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/project-zot/zot/bin/zot /usr/bin/zot
|
||||
COPY --from=builder /go/src/github.com/project-zot/zot/bin/zot-$OS-$ARCH /usr/bin/zot
|
||||
COPY --from=builder /go/src/github.com/project-zot/zot/config.json /etc/zot/config.json
|
||||
ENTRYPOINT ["/usr/bin/zot"]
|
||||
EXPOSE 5000
|
||||
|
|
|
@ -1,34 +0,0 @@
|
|||
# ---
|
||||
# Stage 1: Install certs, build binary, create default config file
|
||||
# ---
|
||||
FROM ghcr.io/project-zot/golang:1.17 AS builder
|
||||
ARG COMMIT
|
||||
ARG ARCH
|
||||
RUN mkdir -p /go/src/github.com/project-zot/zot
|
||||
WORKDIR /go/src/github.com/project-zot/zot
|
||||
COPY . .
|
||||
RUN make COMMIT=$COMMIT 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/project-zot/zot/bin/zot /usr/bin/zot
|
||||
COPY --from=builder /go/src/github.com/project-zot/zot/config.json /etc/zot/config.json
|
||||
ENTRYPOINT ["/usr/bin/zot"]
|
||||
EXPOSE 5000
|
||||
VOLUME ["/var/lib/registry"]
|
||||
CMD ["serve", "/etc/zot/config.json"]
|
|
@ -1,34 +0,0 @@
|
|||
# ---
|
||||
# Stage 1: Install certs, build binary, create default config file
|
||||
# ---
|
||||
FROM ghcr.io/project-zot/golang:1.17 AS builder
|
||||
ARG COMMIT
|
||||
ARG ARCH
|
||||
RUN mkdir -p /go/src/github.com/project-zot/zot
|
||||
WORKDIR /go/src/github.com/project-zot/zot
|
||||
COPY . .
|
||||
RUN make COMMIT=$COMMIT 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/project-zot/zot/bin/zot-minimal /usr/bin/zot
|
||||
COPY --from=builder /go/src/github.com/project-zot/zot/config.json /etc/zot/config.json
|
||||
ENTRYPOINT ["/usr/bin/zot"]
|
||||
EXPOSE 5000
|
||||
VOLUME ["/var/lib/registry"]
|
||||
CMD ["serve", "/etc/zot/config.json"]
|
|
@ -1,17 +0,0 @@
|
|||
# ---
|
||||
# Stage 1: Install certs, build binary, create default config file
|
||||
# ---
|
||||
FROM ghcr.io/project-zot/golang:1.17 AS builder
|
||||
ARG COMMIT
|
||||
ARG ARCH
|
||||
RUN mkdir -p /go/src/github.com/project-zot/zot
|
||||
WORKDIR /go/src/github.com/project-zot/zot
|
||||
COPY . .
|
||||
RUN make COMMIT=$COMMIT ARCH=$ARCH clean bench
|
||||
|
||||
# ---
|
||||
# Stage 2: Final image with nothing but certs, binary, and default config file
|
||||
# ---
|
||||
FROM scratch AS final
|
||||
COPY --from=builder /go/src/github.com/project-zot/zot/bin/zb /usr/bin/zb
|
||||
ENTRYPOINT ["/usr/bin/zb"]
|
|
@ -1,33 +0,0 @@
|
|||
# ---
|
||||
# Stage 1: Build binary, create default config file
|
||||
# ---
|
||||
FROM ghcr.io/project-zot/golang:1.17 AS builder
|
||||
ARG COMMIT
|
||||
ARG ARCH
|
||||
RUN mkdir -p /go/src/github.com/project-zot/zot
|
||||
WORKDIR /go/src/github.com/project-zot/zot
|
||||
COPY . .
|
||||
RUN make COMMIT=$COMMIT ARCH=$ARCH clean exporter-minimal
|
||||
RUN echo '{\n\
|
||||
"Server": {\n\
|
||||
"protocol": "http",\n\
|
||||
"host": "127.0.0.1",\n\
|
||||
"port": "5000"\n\
|
||||
},\n\
|
||||
"Exporter": {\n\
|
||||
"port": "5001",\n\
|
||||
"log": {\n\
|
||||
"level": "debug"\n\
|
||||
}\n\
|
||||
}\n\
|
||||
}\n' > config.json && cat config.json
|
||||
|
||||
# ---
|
||||
# Stage 2: Final image with nothing but binary and default config file
|
||||
# ---
|
||||
FROM scratch AS final
|
||||
COPY --from=builder /go/src/github.com/project-zot/zot/bin/zxp /zxp
|
||||
COPY --from=builder /go/src/github.com/project-zot/zot/config.json /etc/zxp/config.json
|
||||
ENTRYPOINT ["/zxp"]
|
||||
EXPOSE 5001
|
||||
CMD ["config", "/etc/zxp/config.json"]
|
|
@ -22,7 +22,7 @@ storage:\n\
|
|||
# ---
|
||||
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/project-zot/zot/bin/zot /usr/bin/zot
|
||||
COPY --from=builder /go/src/github.com/project-zot/zot/bin/zot-linux-amd64 /usr/bin/zot
|
||||
COPY --from=builder /go/src/github.com/project-zot/zot/config.yml /etc/zot/config.yml
|
||||
ENTRYPOINT ["/usr/bin/zot"]
|
||||
EXPOSE 5000
|
||||
|
|
|
@ -3,10 +3,12 @@
|
|||
# ---
|
||||
FROM ghcr.io/project-zot/golang:1.17 AS builder
|
||||
ARG COMMIT
|
||||
ARG OS
|
||||
ARG ARCH
|
||||
RUN mkdir -p /go/src/github.com/project-zot/zot
|
||||
WORKDIR /go/src/github.com/project-zot/zot
|
||||
COPY . .
|
||||
RUN make COMMIT=$COMMIT clean binary-minimal
|
||||
RUN make COMMIT=$COMMIT OS=$OS ARCH=$ARCH clean binary-minimal
|
||||
RUN echo '{\n\
|
||||
"storage": {\n\
|
||||
"rootDirectory": "/var/lib/registry"\n\
|
||||
|
@ -25,7 +27,7 @@ RUN echo '{\n\
|
|||
# ---
|
||||
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/project-zot/zot/bin/zot-minimal /usr/bin/zot
|
||||
COPY --from=builder /go/src/github.com/project-zot/zot/bin/zot-$OS-$ARCH-minimal /usr/bin/zot
|
||||
COPY --from=builder /go/src/github.com/project-zot/zot/config.json /etc/zot/config.json
|
||||
ENTRYPOINT ["/usr/bin/zot"]
|
||||
EXPOSE 5000
|
||||
|
|
|
@ -3,14 +3,16 @@
|
|||
# ---
|
||||
FROM ghcr.io/project-zot/golang:1.17 AS builder
|
||||
ARG COMMIT
|
||||
ARG OS
|
||||
ARG ARCH
|
||||
RUN mkdir -p /go/src/github.com/project-zot/zot
|
||||
WORKDIR /go/src/github.com/project-zot/zot
|
||||
COPY . .
|
||||
RUN make COMMIT=$COMMIT clean bench
|
||||
RUN make COMMIT=$COMMIT OS=$OS ARCH=$ARCH clean bench
|
||||
|
||||
# ---
|
||||
# Stage 2: Final image with nothing but certs, binary, and default config file
|
||||
# ---
|
||||
FROM scratch AS final
|
||||
COPY --from=builder /go/src/github.com/project-zot/zot/bin/zb /usr/bin/zb
|
||||
COPY --from=builder /go/src/github.com/project-zot/zot/bin/zb-$OS-$ARCH /usr/bin/zb
|
||||
ENTRYPOINT ["/usr/bin/zb"]
|
||||
|
|
|
@ -2,10 +2,13 @@
|
|||
# Stage 1: Build binary, create default config file
|
||||
# ---
|
||||
FROM ghcr.io/project-zot/golang:1.17 AS builder
|
||||
ARG COMMIT
|
||||
ARG OS
|
||||
ARG ARCH
|
||||
RUN mkdir -p /go/src/github.com/project-zot/zot
|
||||
WORKDIR /go/src/github.com/project-zot/zot
|
||||
COPY . .
|
||||
RUN make clean exporter-minimal
|
||||
RUN make COMMIT=$COMMIT OS=$OS ARCH=$ARCH clean exporter-minimal
|
||||
RUN echo '{\n\
|
||||
"Server": {\n\
|
||||
"protocol": "http",\n\
|
||||
|
@ -24,7 +27,7 @@ RUN echo '{\n\
|
|||
# Stage 2: Final image with nothing but binary and default config file
|
||||
# ---
|
||||
FROM scratch AS final
|
||||
COPY --from=builder /go/src/github.com/project-zot/zot/bin/zxp /zxp
|
||||
COPY --from=builder /go/src/github.com/project-zot/zot/bin/zxp-$OS-$ARCH /zxp
|
||||
COPY --from=builder /go/src/github.com/project-zot/zot/config.json /etc/zxp/config.json
|
||||
ENTRYPOINT ["/zxp"]
|
||||
EXPOSE 5001
|
||||
|
|
56
Makefile
56
Makefile
|
@ -15,51 +15,31 @@ ARCH ?= amd64
|
|||
BENCH_OUTPUT ?= stdout
|
||||
|
||||
.PHONY: all
|
||||
all: swagger binary binary-minimal binary-debug binary-arch binary-arch-minimal cli cli-arch bench bench-arch exporter-minimal verify-config test covhtml test-clean check
|
||||
|
||||
.PHONY: binary-minimal
|
||||
binary-minimal: swagger
|
||||
env CGO_ENABLED=0 GOOS=$(OS) GOARCH=$(ARCH) go build -o bin/zot-minimal -tags minimal,containers_image_openpgp -v -trimpath -ldflags "-X zotregistry.io/zot/pkg/api/config.Commit=${COMMIT} -X zotregistry.io/zot/pkg/api/config.BinaryType=minimal -X zotregistry.io/zot/pkg/api/config.GoVersion=${GO_VERSION} -s -w" ./cmd/zot
|
||||
|
||||
.PHONY: binary
|
||||
binary: swagger
|
||||
env CGO_ENABLED=0 GOOS=$(OS) GOARCH=$(ARCH) go build -o bin/zot -tags extended,containers_image_openpgp -v -trimpath -ldflags "-X zotregistry.io/zot/pkg/api/config.Commit=${COMMIT} -X zotregistry.io/zot/pkg/api/config.BinaryType=extended -X zotregistry.io/zot/pkg/api/config.GoVersion=${GO_VERSION} -s -w" ./cmd/zot
|
||||
all: swagger binary binary-minimal binary-debug cli bench exporter-minimal verify-config test covhtml test-clean check
|
||||
|
||||
.PHONY: binary-debug
|
||||
binary-debug: swagger
|
||||
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 zotregistry.io/zot/pkg/api/config.Commit=${COMMIT} -X zotregistry.io/zot/pkg/api/config.BinaryType=extended -X zotregistry.io/zot/pkg/api/config.GoVersion=${GO_VERSION}" ./cmd/zot
|
||||
env CGO_ENABLED=0 GOOS=$(OS) GOARCH=$(ARCH) go build -o bin/zot-$(OS)-$(ARCH)-debug -tags extended,containers_image_openpgp -v -gcflags all='-N -l' -ldflags "-X zotregistry.io/zot/pkg/api/config.Commit=${COMMIT} -X zotregistry.io/zot/pkg/api/config.BinaryType=extended -X zotregistry.io/zot/pkg/api/config.GoVersion=${GO_VERSION}" ./cmd/zot
|
||||
|
||||
.PHONY: binary-arch-minimal
|
||||
binary-arch-minimal: swagger
|
||||
env CGO_ENABLED=0 GOOS=$(OS) GOARCH=$(ARCH) go build -o bin/zot-$(ARCH)-minimal -tags minimal,containers_image_openpgp -v -trimpath -ldflags "-X zotregistry.io/zot/pkg/api/config.Commit=${COMMIT} -X zotregistry.io/zot/pkg/api/config.BinaryType=minimal -X zotregistry.io/zot/pkg/api/config.GoVersion=${GO_VERSION} -s -w" ./cmd/zot
|
||||
.PHONY: binary-minimal
|
||||
binary-minimal: swagger
|
||||
env CGO_ENABLED=0 GOOS=$(OS) GOARCH=$(ARCH) go build -o bin/zot-$(OS)-$(ARCH)-minimal -tags minimal,containers_image_openpgp -v -trimpath -ldflags "-X zotregistry.io/zot/pkg/api/config.Commit=${COMMIT} -X zotregistry.io/zot/pkg/api/config.BinaryType=minimal -X zotregistry.io/zot/pkg/api/config.GoVersion=${GO_VERSION} -s -w" ./cmd/zot
|
||||
|
||||
.PHONY: binary-arch
|
||||
binary-arch: swagger
|
||||
env CGO_ENABLED=0 GOOS=$(OS) GOARCH=$(ARCH) go build -o bin/zot-$(ARCH) -tags extended,containers_image_openpgp -v -trimpath -ldflags "-X zotregistry.io/zot/pkg/api/config.Commit=${COMMIT} -X zotregistry.io/zot/pkg/api/config.BinaryType=extended -X zotregistry.io/zot/pkg/api/config.GoVersion=${GO_VERSION} -s -w" ./cmd/zot
|
||||
.PHONY: binary
|
||||
binary: swagger
|
||||
env CGO_ENABLED=0 GOOS=$(OS) GOARCH=$(ARCH) go build -o bin/zot-$(OS)-$(ARCH) -tags extended,containers_image_openpgp -v -trimpath -ldflags "-X zotregistry.io/zot/pkg/api/config.Commit=${COMMIT} -X zotregistry.io/zot/pkg/api/config.BinaryType=extended -X zotregistry.io/zot/pkg/api/config.GoVersion=${GO_VERSION} -s -w" ./cmd/zot
|
||||
|
||||
.PHONY: cli
|
||||
cli:
|
||||
env CGO_ENABLED=0 GOOS=$(OS) GOARCH=$(ARCH) go build -o bin/zli -tags extended,containers_image_openpgp -v -trimpath -ldflags "-X zotregistry.io/zot/pkg/api/config.Commit=${COMMIT} -X zotregistry.io/zot/pkg/api/config.BinaryType=extended -X zotregistry.io/zot/pkg/api/config.GoVersion=${GO_VERSION} -s -w" ./cmd/zli
|
||||
|
||||
.PHONY: cli-arch
|
||||
cli-arch:
|
||||
env CGO_ENABLED=0 GOOS=$(OS) GOARCH=$(ARCH) go build -o bin/zli-$(ARCH) -tags extended,containers_image_openpgp -v -trimpath -ldflags "-X zotregistry.io/zot/pkg/api/config.Commit=${COMMIT} -X zotregistry.io/zot/pkg/api/config.BinaryType=extended -X zotregistry.io/zot/pkg/api/config.GoVersion=${GO_VERSION} -s -w" ./cmd/zli
|
||||
env CGO_ENABLED=0 GOOS=$(OS) GOARCH=$(ARCH) go build -o bin/zli-$(OS)-$(ARCH) -tags extended,containers_image_openpgp -v -trimpath -ldflags "-X zotregistry.io/zot/pkg/api/config.Commit=${COMMIT} -X zotregistry.io/zot/pkg/api/config.BinaryType=extended -X zotregistry.io/zot/pkg/api/config.GoVersion=${GO_VERSION} -s -w" ./cmd/zli
|
||||
|
||||
.PHONY: bench
|
||||
bench:
|
||||
env CGO_ENABLED=0 GOOS=$(OS) GOARCH=$(ARCH) go build -o bin/zb -tags extended,containers_image_openpgp -v -trimpath -ldflags "-X zotregistry.io/zot/pkg/api/config.Commit=${COMMIT} -X zotregistry.io/zot/pkg/api/config.BinaryType=extended -X zotregistry.io/zot/pkg/api/config.GoVersion=${GO_VERSION} -s -w" ./cmd/zb
|
||||
|
||||
.PHONY: bench-arch
|
||||
bench-arch:
|
||||
env CGO_ENABLED=0 GOOS=$(OS) GOARCH=$(ARCH) go build -o bin/zb-$(ARCH) -tags extended,containers_image_openpgp -v -trimpath -ldflags "-X zotregistry.io/zot/pkg/api/config.Commit=${COMMIT} -X zotregistry.io/zot/pkg/api/config.BinaryType=extended -X zotregistry.io/zot/pkg/api/config.GoVersion=${GO_VERSION} -s -w" ./cmd/zb
|
||||
env CGO_ENABLED=0 GOOS=$(OS) GOARCH=$(ARCH) go build -o bin/zb-$(OS)-$(ARCH) -tags extended,containers_image_openpgp -v -trimpath -ldflags "-X zotregistry.io/zot/pkg/api/config.Commit=${COMMIT} -X zotregistry.io/zot/pkg/api/config.BinaryType=extended -X zotregistry.io/zot/pkg/api/config.GoVersion=${GO_VERSION} -s -w" ./cmd/zb
|
||||
|
||||
.PHONY: exporter-minimal
|
||||
exporter-minimal:
|
||||
env CGO_ENABLED=0 GOOS=$(OS) GOARCH=$(ARCH) go build -o bin/zxp -tags minimal,containers_image_openpgp -v -trimpath ./cmd/zxp
|
||||
|
||||
.PHONY: exporter-arch-minimal
|
||||
exporter-arch-minimal:
|
||||
env CGO_ENABLED=0 GOOS=$(OS) GOARCH=$(ARCH) go build -o bin/zxp-$(ARCH) -tags minimal,containers_image_openpgp -v -trimpath ./cmd/zxp
|
||||
env CGO_ENABLED=0 GOOS=$(OS) GOARCH=$(ARCH) go build -o bin/zxp-$(OS)-$(ARCH) -tags minimal,containers_image_openpgp -v -trimpath ./cmd/zxp
|
||||
|
||||
.PHONY: test
|
||||
test: check-skopeo $(NOTATION)
|
||||
|
@ -74,14 +54,14 @@ test: check-skopeo $(NOTATION)
|
|||
|
||||
.PHONY: run-bench
|
||||
run-bench: binary bench
|
||||
bin/zot serve examples/config-minimal.json &
|
||||
bin/zot-$(OS)-$(ARCH) serve examples/config-minimal.json &
|
||||
sleep 5
|
||||
bin/zb -c 10 -n 100 -o $(BENCH_OUTPUT) http://localhost:8080
|
||||
killall zot
|
||||
bin/zb-$(OS)-$(ARCH) -c 10 -n 100 -o $(BENCH_OUTPUT) http://localhost:8080
|
||||
killall -r zot-*
|
||||
|
||||
.PHONY: push-pull
|
||||
push-pull: binary check-skopeo
|
||||
bin/zot serve examples/config-minimal.json &
|
||||
bin/zot-$(OS)-$(ARCH) serve examples/config-minimal.json &
|
||||
sleep 5
|
||||
# skopeo push/pull
|
||||
skopeo --debug copy --format=oci --dest-tls-verify=false docker://ghcr.io/project-zot/golang:1.17 docker://localhost:8080/golang:1.17
|
||||
|
@ -96,10 +76,10 @@ push-pull: binary check-skopeo
|
|||
oras pull localhost:8080/hello-artifact:v2 -d -v -a
|
||||
grep -q "hello world" artifact.txt # should print "hello world"
|
||||
if [ $? -ne 0 ]; then \
|
||||
killall zot; \
|
||||
killall -r zot-*; \
|
||||
exit 1; \
|
||||
fi
|
||||
killall zot
|
||||
killall -r zot-*
|
||||
|
||||
.PHONY: test-clean
|
||||
test-clean:
|
||||
|
@ -180,7 +160,7 @@ clean:
|
|||
|
||||
.PHONY: run
|
||||
run: binary test
|
||||
./bin/zot serve examples/config-test.json
|
||||
./bin/zot-$(OS)-$(ARCH) serve examples/config-test.json
|
||||
|
||||
.PHONY: verify-config
|
||||
verify-config: binary
|
||||
|
|
Loading…
Reference in a new issue