mirror of
https://github.com/project-zot/zot.git
synced 2024-12-16 21:56:37 -05:00
ci/cd: Fix arm builds, use distroless final image
Signed-off-by: Petu Eusebiu <peusebiu@cisco.com>
This commit is contained in:
parent
62775cc095
commit
d0b52612a2
5 changed files with 110 additions and 57 deletions
64
.github/workflows/ci-cd.yml
vendored
64
.github/workflows/ci-cd.yml
vendored
|
@ -129,7 +129,15 @@ jobs:
|
|||
- name: Run zot container image with docker
|
||||
run: |
|
||||
if [[ $OS == "linux" && $ARCH == "amd64" ]]; then
|
||||
docker run -d ghcr.io/${{ github.repository_owner }}/zot-${{ matrix.os }}-${{ matrix.arch }}:${{ github.event.release.tag_name }}
|
||||
docker run -d -p 5000:5000 ghcr.io/${{ github.repository_owner }}/zot-${{ matrix.os }}-${{ matrix.arch }}:${{ github.event.release.tag_name }}
|
||||
sleep 2
|
||||
curl --connect-timeout 5 \
|
||||
--max-time 10 \
|
||||
--retry 12 \
|
||||
--retry-max-time 360 \
|
||||
--retry-connrefused \
|
||||
'http://localhost:5000/v2/'
|
||||
docker kill $(docker ps -q)
|
||||
fi
|
||||
env:
|
||||
OS: ${{ matrix.os }}
|
||||
|
@ -137,7 +145,15 @@ jobs:
|
|||
- name: Run zot container image with podman
|
||||
run: |
|
||||
if [[ $OS == "linux" && $ARCH == "amd64" ]]; then
|
||||
podman run -d ghcr.io/${{ github.repository_owner }}/zot-${{ matrix.os }}-${{ matrix.arch }}:${{ github.event.release.tag_name }}
|
||||
podman run -d -p 5000:5000 ghcr.io/${{ github.repository_owner }}/zot-${{ matrix.os }}-${{ matrix.arch }}:${{ github.event.release.tag_name }}
|
||||
sleep 2
|
||||
curl --connect-timeout 5 \
|
||||
--max-time 10 \
|
||||
--retry 12 \
|
||||
--retry-max-time 360 \
|
||||
--retry-connrefused \
|
||||
'http://localhost:5000/v2/'
|
||||
podman kill --all
|
||||
fi
|
||||
env:
|
||||
OS: ${{ matrix.os }}
|
||||
|
@ -159,7 +175,15 @@ jobs:
|
|||
- name: Run zot-minimal container image with docker
|
||||
run: |
|
||||
if [[ $OS == "linux" && $ARCH == "amd64" ]]; then
|
||||
docker run -d ghcr.io/${{ github.repository_owner }}/zot-minimal-${{ matrix.os }}-${{ matrix.arch }}:${{ github.event.release.tag_name }}
|
||||
docker run -d -p 5000:5000 ghcr.io/${{ github.repository_owner }}/zot-minimal-${{ matrix.os }}-${{ matrix.arch }}:${{ github.event.release.tag_name }}
|
||||
sleep 2
|
||||
curl --connect-timeout 5 \
|
||||
--max-time 10 \
|
||||
--retry 12 \
|
||||
--retry-max-time 360 \
|
||||
--retry-connrefused \
|
||||
'http://localhost:5000/v2/'
|
||||
docker kill $(docker ps -q)
|
||||
fi
|
||||
env:
|
||||
OS: ${{ matrix.os }}
|
||||
|
@ -167,7 +191,15 @@ jobs:
|
|||
- name: Run zot-minimal container image with podman
|
||||
run: |
|
||||
if [[ $OS == "linux" && $ARCH == "amd64" ]]; then
|
||||
podman run -d ghcr.io/${{ github.repository_owner }}/zot-minimal-${{ matrix.os }}-${{ matrix.arch }}:${{ github.event.release.tag_name }}
|
||||
podman run -d -p 5000:5000 ghcr.io/${{ github.repository_owner }}/zot-minimal-${{ matrix.os }}-${{ matrix.arch }}:${{ github.event.release.tag_name }}
|
||||
sleep 2
|
||||
curl --connect-timeout 5 \
|
||||
--max-time 10 \
|
||||
--retry 12 \
|
||||
--retry-max-time 360 \
|
||||
--retry-connrefused \
|
||||
'http://localhost:5000/v2/'
|
||||
podman kill --all
|
||||
fi
|
||||
env:
|
||||
OS: ${{ matrix.os }}
|
||||
|
@ -188,7 +220,15 @@ jobs:
|
|||
- name: Run zot-exporter container image with docker
|
||||
run: |
|
||||
if [[ $OS == "linux" && $ARCH == "amd64" ]]; then
|
||||
docker run -d ghcr.io/${{ github.repository_owner }}/zxp-${{ matrix.os }}-${{ matrix.arch }}:${{ github.event.release.tag_name }}
|
||||
docker run -d -p 5001:5001 ghcr.io/${{ github.repository_owner }}/zxp-${{ matrix.os }}-${{ matrix.arch }}:${{ github.event.release.tag_name }}
|
||||
sleep 2
|
||||
curl --connect-timeout 5 \
|
||||
--max-time 10 \
|
||||
--retry 12 \
|
||||
--retry-max-time 360 \
|
||||
--retry-connrefused \
|
||||
'http://localhost:5001/metrics'
|
||||
docker kill $(docker ps -q)
|
||||
fi
|
||||
env:
|
||||
OS: ${{ matrix.os }}
|
||||
|
@ -196,7 +236,15 @@ jobs:
|
|||
- name: Run zot-exporter container image with podman
|
||||
run: |
|
||||
if [[ $OS == "linux" && $ARCH == "amd64" ]]; then
|
||||
podman run -d ghcr.io/${{ github.repository_owner }}/zxp-${{ matrix.os }}-${{ matrix.arch }}:${{ github.event.release.tag_name }}
|
||||
podman run -d -p 5001:5001 ghcr.io/${{ github.repository_owner }}/zxp-${{ matrix.os }}-${{ matrix.arch }}:${{ github.event.release.tag_name }}
|
||||
sleep 2
|
||||
curl --connect-timeout 5 \
|
||||
--max-time 10 \
|
||||
--retry 12 \
|
||||
--retry-max-time 360 \
|
||||
--retry-connrefused \
|
||||
'http://localhost:5001/metrics'
|
||||
podman kill --all
|
||||
fi
|
||||
env:
|
||||
OS: ${{ matrix.os }}
|
||||
|
@ -217,7 +265,7 @@ jobs:
|
|||
- name: Run zb container image with docker
|
||||
run: |
|
||||
if [[ $OS == "linux" && $ARCH == "amd64" ]]; then
|
||||
docker run -d ghcr.io/${{ github.repository_owner }}/zb-${{ matrix.os }}-${{ matrix.arch }}:${{ github.event.release.tag_name }}
|
||||
docker run ghcr.io/${{ github.repository_owner }}/zb-${{ matrix.os }}-${{ matrix.arch }}:${{ github.event.release.tag_name }} --help
|
||||
fi
|
||||
env:
|
||||
OS: ${{ matrix.os }}
|
||||
|
@ -225,7 +273,7 @@ jobs:
|
|||
- name: Run zb container image with podman
|
||||
run: |
|
||||
if [[ $OS == "linux" && $ARCH == "amd64" ]]; then
|
||||
podman run -d ghcr.io/${{ github.repository_owner }}/zb-${{ matrix.os }}-${{ matrix.arch }}:${{ github.event.release.tag_name }}
|
||||
podman run ghcr.io/${{ github.repository_owner }}/zb-${{ matrix.os }}-${{ matrix.arch }}:${{ github.event.release.tag_name }} --help
|
||||
fi
|
||||
env:
|
||||
OS: ${{ matrix.os }}
|
||||
|
|
|
@ -14,7 +14,7 @@ build:
|
|||
cd /go/src/github.com/project-zot
|
||||
git clone /zotcopy zot
|
||||
cd /go/src/github.com/project-zot/zot
|
||||
make COMMIT=${{COMMIT}} OS=${{OS}} ARCH=${{ARCH}} binary
|
||||
make COMMIT=${{COMMIT}} clean binary
|
||||
cat > config.json << EOF
|
||||
{
|
||||
"storage":{
|
||||
|
@ -33,25 +33,28 @@ build:
|
|||
EOF
|
||||
|
||||
cat config.json
|
||||
|
||||
mkdir -p /zotcopy/build/binary
|
||||
mkdir -p /zotcopy/build/cert
|
||||
mkdir -p /zotcopy/build/config
|
||||
cp /go/src/github.com/project-zot/zot/bin/zot-linux-amd64 /zotcopy/build/binary
|
||||
cp /go/src/github.com/project-zot/zot/config.json /zotcopy/build/config
|
||||
cp /etc/ssl/certs/ca-certificates.crt /zotcopy/build/cert
|
||||
build_only: true
|
||||
|
||||
"${{REPO_NAME:zot}}":
|
||||
from:
|
||||
type: docker
|
||||
url: docker://alpine:3
|
||||
import:
|
||||
- stacker://build/go/src/github.com/project-zot/zot/bin/zot-${{OS}}-${{ARCH}}
|
||||
- stacker://build/go/src/github.com/project-zot/zot/config.json
|
||||
- stacker://build/etc/ssl/certs/ca-certificates.crt
|
||||
run: |
|
||||
cp /stacker/ca-certificates.crt /etc/ssl/certs/ca-certificates.crt
|
||||
cp /stacker/zot-${{OS}}-${{ARCH}} /usr/bin/zot
|
||||
mkdir -p /etc/zot
|
||||
cp /stacker/config.json /etc/zot/config.json
|
||||
# pie mode binaries need a runtime
|
||||
apk add --no-cache libc6-compat
|
||||
url: docker://gcr.io/distroless/base
|
||||
overlay_dirs:
|
||||
- source: ./build/binary
|
||||
dest: /usr/local/bin
|
||||
- source: ./build/cert
|
||||
dest: /etc/ssl/certs
|
||||
- source: ./build/config
|
||||
dest: /etc/zot
|
||||
entrypoint:
|
||||
- /usr/bin/zot
|
||||
- /usr/bin/zot-linux-amd64
|
||||
volumes:
|
||||
- /var/lib/registry
|
||||
cmd:
|
||||
|
|
|
@ -14,17 +14,17 @@ build:
|
|||
git clone /zotcopy zot
|
||||
cd /go/src/github.com/project-zot/zot
|
||||
make COMMIT=${{COMMIT}} OS=${{OS}} ARCH=${{ARCH}} clean bench
|
||||
|
||||
mkdir -p /zotcopy/build/binary
|
||||
cp /go/src/github.com/project-zot/zot/bin/zb-${{OS}}-${{ARCH}} /zotcopy/build/binary
|
||||
build_only: true
|
||||
|
||||
"${{REPO_NAME:zb}}":
|
||||
from:
|
||||
type: docker
|
||||
url: docker://alpine:3
|
||||
import:
|
||||
- stacker://build/go/src/github.com/project-zot/zot/bin/zb-${{OS}}-${{ARCH}}
|
||||
run: |
|
||||
cp /stacker/zb-${{OS}}-${{ARCH}} /usr/bin/zb
|
||||
# pie mode binaries need a runtime
|
||||
apk add --no-cache libc6-compat
|
||||
url: docker://gcr.io/distroless/base
|
||||
overlay_dirs:
|
||||
- source: ./build/binary
|
||||
dest: /usr/local/bin
|
||||
entrypoint:
|
||||
- /usr/bin/zb
|
||||
- /usr/local/bin/zb-${{OS}}-${{ARCH}}
|
||||
|
|
|
@ -32,23 +32,24 @@ build:
|
|||
EOF
|
||||
|
||||
cat config.json
|
||||
|
||||
mkdir -p /zotcopy/build/binary
|
||||
mkdir -p /zotcopy/build/config
|
||||
cp /go/src/github.com/project-zot/zot/bin/zxp-${{OS}}-${{ARCH}} /zotcopy/build/binary
|
||||
cp /go/src/github.com/project-zot/zot/config.json /zotcopy/build/config
|
||||
build_only: true
|
||||
|
||||
"${{REPO_NAME:zxp}}":
|
||||
from:
|
||||
type: docker
|
||||
url: docker://alpine:3
|
||||
import:
|
||||
- stacker://build/go/src/github.com/project-zot/zot/bin/zxp-${{OS}}-${{ARCH}}
|
||||
- stacker://build/go/src/github.com/project-zot/zot/config.json
|
||||
run: |
|
||||
cp /stacker/zxp-${{OS}}-${{ARCH}} /usr/bin/zxp
|
||||
mkdir -p /etc/zxp
|
||||
cp /stacker/config.json /etc/zxp/config.json
|
||||
# pie mode binaries need a runtime
|
||||
apk add --no-cache libc6-compat
|
||||
url: docker://gcr.io/distroless/base
|
||||
overlay_dirs:
|
||||
- source: ./build/binary
|
||||
dest: /usr/local/bin
|
||||
- source: ./build/config
|
||||
dest: /etc/zxp
|
||||
entrypoint:
|
||||
- /usr/bin/zxp
|
||||
- /usr/local/bin/zxp-${{OS}}-${{ARCH}}
|
||||
cmd:
|
||||
- config
|
||||
- /etc/zxp/config.json
|
||||
|
|
33
stacker.yaml
33
stacker.yaml
|
@ -5,7 +5,7 @@ build:
|
|||
binds:
|
||||
- . -> /zotcopy
|
||||
run: |
|
||||
export GO111MODULE=on
|
||||
export GO111MODULE=on
|
||||
export GOPATH='/go'
|
||||
export HOME='/root'
|
||||
export PATH='/go/bin:/usr/local/go/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin'
|
||||
|
@ -14,7 +14,7 @@ build:
|
|||
cd /go/src/github.com/project-zot
|
||||
git clone /zotcopy zot
|
||||
cd /go/src/github.com/project-zot/zot
|
||||
make COMMIT=${{COMMIT}} OS=${{OS}} ARCH=${{ARCH}} binary${{EXT:}}
|
||||
make COMMIT=${{COMMIT}} OS=${{OS}} ARCH=${{ARCH}} clean binary${{EXT:}}
|
||||
cat > config.json << EOF
|
||||
{
|
||||
"storage":{
|
||||
|
@ -31,28 +31,29 @@ build:
|
|||
EOF
|
||||
|
||||
cat config.json
|
||||
mkdir -p /zotcopy/build/binary
|
||||
mkdir -p /zotcopy/build/cert
|
||||
mkdir -p /zotcopy/build/config
|
||||
cp /go/src/github.com/project-zot/zot/bin/zot-${{OS}}-${{ARCH}}${{EXT:}} /zotcopy/build/binary
|
||||
cp /go/src/github.com/project-zot/zot/config.json /zotcopy/build/config
|
||||
cp /etc/ssl/certs/ca-certificates.crt /zotcopy/build/cert
|
||||
build_only: true
|
||||
|
||||
"${{REPO_NAME:zot}}":
|
||||
from:
|
||||
type: docker
|
||||
url: docker://alpine:3
|
||||
import:
|
||||
- stacker://build/go/src/github.com/project-zot/zot/bin/zot-${{OS}}-${{ARCH}}${{EXT:}}
|
||||
- stacker://build/go/src/github.com/project-zot/zot/config.json
|
||||
- stacker://build/etc/ssl/certs/ca-certificates.crt
|
||||
run: |
|
||||
cp /stacker/ca-certificates.crt /etc/ssl/certs/ca-certificates.crt
|
||||
cp /stacker/zot-${{OS}}-${{ARCH}}${{EXT:}} /usr/bin/zot
|
||||
mkdir -p /etc/zot
|
||||
cp /stacker/config.json /etc/zot/config.json
|
||||
# pie mode binaries need a runtime
|
||||
apk add --no-cache libc6-compat
|
||||
url: docker://gcr.io/distroless/base
|
||||
overlay_dirs:
|
||||
- source: ./build/binary
|
||||
dest: /usr/local/bin
|
||||
- source: ./build/cert
|
||||
dest: /etc/ssl/certs
|
||||
- source: ./build/config
|
||||
dest: /etc/zot
|
||||
entrypoint:
|
||||
- /usr/bin/zot
|
||||
- /usr/local/bin/zot-${{OS}}-${{ARCH}}${{EXT:}}
|
||||
volumes:
|
||||
- /var/lib/registry
|
||||
cmd:
|
||||
- serve
|
||||
- /etc/zot/config.json
|
||||
|
||||
|
|
Loading…
Reference in a new issue