mirror of
https://github.com/project-zot/zot.git
synced 2026-06-17 12:58:02 +08:00
build: move build artifacts into build/ (#986)
Unclutter the root dir by moving all docker/stacker build artifacts into build/ folder. Signed-off-by: Ramkumar Chinchani <rchincha@cisco.com>
This commit is contained in:
committed by
GitHub
parent
94d073ceab
commit
97e7f7f756
@@ -0,0 +1,37 @@
|
||||
# ---
|
||||
# Stage 1: Install certs, build binary, create default config file
|
||||
# ---
|
||||
FROM ghcr.io/project-zot/golang:1.19 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 OS=$OS 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 gcr.io/distroless/base AS final
|
||||
ARG OS
|
||||
ARG ARCH
|
||||
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-$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
|
||||
VOLUME ["/var/lib/registry"]
|
||||
CMD ["serve", "/etc/zot/config.json"]
|
||||
@@ -0,0 +1,30 @@
|
||||
# ---
|
||||
# Stage 1: Install certs, build binary, create default config file
|
||||
# ---
|
||||
FROM ghcr.io/project-zot/golang:1.19 AS builder
|
||||
ARG COMMIT
|
||||
RUN apt-get update && apt-get install -y git make ca-certificates
|
||||
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 echo '# Default config file for zot server\n\
|
||||
http:\n\
|
||||
address: 0.0.0.0\n\
|
||||
port: 5000\n\
|
||||
storage:\n\
|
||||
rootDirectory: /var/lib/registry\n\
|
||||
gc: false\n\
|
||||
dedupe: false' > config.yml && cat config.yml
|
||||
|
||||
# ---
|
||||
# Stage 2: Final image with nothing but certs, binary, and default config file
|
||||
# ---
|
||||
FROM gcr.io/distroless/base 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-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
|
||||
VOLUME ["/var/lib/registry"]
|
||||
CMD ["serve", "/etc/zot/config.yml"]
|
||||
@@ -0,0 +1,37 @@
|
||||
# ---
|
||||
# Stage 1: Install certs, build binary, create default config file
|
||||
# ---
|
||||
FROM ghcr.io/project-zot/golang:1.19 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 OS=$OS 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 gcr.io/distroless/base AS final
|
||||
ARG OS
|
||||
ARG ARCH
|
||||
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-$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
|
||||
VOLUME ["/var/lib/registry"]
|
||||
CMD ["serve", "/etc/zot/config.json"]
|
||||
@@ -0,0 +1,20 @@
|
||||
# ---
|
||||
# Stage 1: Install certs, build binary, create default config file
|
||||
# ---
|
||||
FROM ghcr.io/project-zot/golang:1.19 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 OS=$OS ARCH=$ARCH clean bench
|
||||
|
||||
# ---
|
||||
# Stage 2: Final image with nothing but certs, binary, and default config file
|
||||
# ---
|
||||
FROM gcr.io/distroless/base AS final
|
||||
ARG OS
|
||||
ARG ARCH
|
||||
COPY --from=builder /go/src/github.com/project-zot/zot/bin/zb-$OS-$ARCH /usr/bin/zb
|
||||
ENTRYPOINT ["/usr/bin/zb"]
|
||||
@@ -0,0 +1,36 @@
|
||||
# ---
|
||||
# Stage 1: Build binary, create default config file
|
||||
# ---
|
||||
FROM ghcr.io/project-zot/golang:1.19 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 OS=$OS 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 gcr.io/distroless/base AS final
|
||||
ARG OS
|
||||
ARG ARCH
|
||||
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
|
||||
CMD ["config", "/etc/zxp/config.json"]
|
||||
@@ -0,0 +1,63 @@
|
||||
build:
|
||||
from:
|
||||
type: docker
|
||||
url: docker://ghcr.io/project-zot/golang:1.19
|
||||
binds:
|
||||
- . -> /zotcopy
|
||||
run: |
|
||||
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'
|
||||
mkdir -p /go/src/github.com/project-zot
|
||||
cd /go/src/github.com/project-zot
|
||||
git clone /zotcopy zot
|
||||
cd /go/src/github.com/project-zot/zot
|
||||
make COMMIT=${{COMMIT}} clean binary
|
||||
cat > config.json << EOF
|
||||
{
|
||||
"storage":{
|
||||
"rootDirectory":"/var/lib/registry",
|
||||
"gc": false,
|
||||
"dedupe": false
|
||||
},
|
||||
"http":{
|
||||
"address":"0.0.0.0",
|
||||
"port":"5000"
|
||||
},
|
||||
"log":{
|
||||
"level":"debug"
|
||||
}
|
||||
}
|
||||
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}}":
|
||||
os: ${{OS}}
|
||||
arch: ${{ARCH}}
|
||||
from:
|
||||
type: docker
|
||||
url: docker://gcr.io/distroless/base:latest-${{ARCH}}
|
||||
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-linux-amd64
|
||||
volumes:
|
||||
- /var/lib/registry
|
||||
cmd:
|
||||
- serve
|
||||
- /etc/zot/config.json
|
||||
@@ -0,0 +1,32 @@
|
||||
build:
|
||||
from:
|
||||
type: docker
|
||||
url: docker://ghcr.io/project-zot/golang:1.19
|
||||
binds:
|
||||
- . -> /zotcopy
|
||||
run: |
|
||||
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'
|
||||
mkdir -p /go/src/github.com/project-zot
|
||||
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}} 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}}":
|
||||
os: ${{OS}}
|
||||
arch: ${{ARCH}}
|
||||
from:
|
||||
type: docker
|
||||
url: docker://gcr.io/distroless/base:latest-${{ARCH}}
|
||||
overlay_dirs:
|
||||
- source: ./build/binary
|
||||
dest: /usr/local/bin
|
||||
entrypoint:
|
||||
- /usr/local/bin/zb-${{OS}}-${{ARCH}}
|
||||
@@ -0,0 +1,57 @@
|
||||
build:
|
||||
from:
|
||||
type: docker
|
||||
url: docker://ghcr.io/project-zot/golang:1.19
|
||||
binds:
|
||||
- . -> /zotcopy
|
||||
run: |
|
||||
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'
|
||||
mkdir -p /go/src/github.com/project-zot
|
||||
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}} clean exporter-minimal
|
||||
|
||||
cat > config.json << EOF
|
||||
{
|
||||
"Server":{
|
||||
"protocol":"http",
|
||||
"host": "127.0.0.1",
|
||||
"port": "5000"
|
||||
},
|
||||
"Exporter":{
|
||||
"port":"5001",
|
||||
"log":{
|
||||
"level":"debug"
|
||||
}
|
||||
}
|
||||
}
|
||||
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}}":
|
||||
os: ${{OS}}
|
||||
arch: ${{ARCH}}
|
||||
from:
|
||||
type: docker
|
||||
url: docker://gcr.io/distroless/base:latest-${{ARCH}}
|
||||
overlay_dirs:
|
||||
- source: ./build/binary
|
||||
dest: /usr/local/bin
|
||||
- source: ./build/config
|
||||
dest: /etc/zxp
|
||||
entrypoint:
|
||||
- /usr/local/bin/zxp-${{OS}}-${{ARCH}}
|
||||
cmd:
|
||||
- config
|
||||
- /etc/zxp/config.json
|
||||
@@ -0,0 +1,60 @@
|
||||
build:
|
||||
from:
|
||||
type: docker
|
||||
url: docker://ghcr.io/project-zot/golang:1.19
|
||||
binds:
|
||||
- . -> /zotcopy
|
||||
run: |
|
||||
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'
|
||||
mkdir -p /go/src/github.com/project-zot
|
||||
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}} RELEASE_TAG=${{RELEASE_TAG}} clean binary${{EXT:}}
|
||||
cat > config.json << EOF
|
||||
{
|
||||
"storage":{
|
||||
"rootDirectory":"/var/lib/registry"
|
||||
},
|
||||
"http":{
|
||||
"address":"0.0.0.0",
|
||||
"port":"5000"
|
||||
},
|
||||
"log":{
|
||||
"level":"debug"
|
||||
}
|
||||
}
|
||||
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}}":
|
||||
os: ${{OS}}
|
||||
arch: ${{ARCH}}
|
||||
from:
|
||||
type: docker
|
||||
url: docker://gcr.io/distroless/base:latest-${{ARCH}}
|
||||
overlay_dirs:
|
||||
- source: ./build/binary
|
||||
dest: /usr/local/bin
|
||||
- source: ./build/cert
|
||||
dest: /etc/ssl/certs
|
||||
- source: ./build/config
|
||||
dest: /etc/zot
|
||||
entrypoint:
|
||||
- /usr/local/bin/zot-${{OS}}-${{ARCH}}${{EXT:}}
|
||||
volumes:
|
||||
- /var/lib/registry
|
||||
cmd:
|
||||
- serve
|
||||
- /etc/zot/config.json
|
||||
Reference in New Issue
Block a user