0
Fork 0
mirror of https://github.com/project-zot/zot.git synced 2024-12-16 21:56:37 -05:00

Merge pull request #147 from rchincha/docker

build: update docker and stacker files
This commit is contained in:
Ramkumar Chinchani 2020-11-20 08:50:26 -08:00 committed by GitHub
commit 7854083021
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 29 additions and 26 deletions

View file

@ -22,7 +22,7 @@ install:
- if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then wget -N https://github.com/bazelbuild/bazel/releases/download/3.0.0/bazel-3.0.0-installer-linux-x86_64.sh && chmod +x bazel-3.0.0-installer-linux-x86_64.sh && ./bazel-3.0.0-installer-linux-x86_64.sh --user; go get -u github.com/swaggo/swag/cmd/swag; go mod download; sudo apt-get update; sudo apt-get install rpm; sudo apt install snapd; sudo snap install skopeo --edge --devmode; fi
script:
- if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then travis_wait 40 make && travis_wait 40 make -f Makefile.bazel build; fi
- if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then travis_wait 60 make; fi
after_success:
- bash <(curl -s https://codecov.io/bash)

View file

@ -1,18 +1,23 @@
# ---
# Stage 1: Install certs, build binary, create default config file
# ---
FROM docker.io/golang:1.13.6-alpine3.11 AS builder
RUN apk --update add git make ca-certificates
FROM docker.io/golang:1.15.3 AS builder
RUN mkdir -p /go/src/github.com/anuvu/zot
WORKDIR /go/src/github.com/anuvu/zot
COPY . .
RUN CGO_ENABLED=0 make clean binary
RUN echo -e '# Default config file for zot server\n\
http:\n\
address: 0.0.0.0\n\
port: 5000\n\
storage:\n\
rootDirectory: /var/lib/registry' > config.yml && cat config.yml
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
@ -20,8 +25,8 @@ 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/anuvu/zot/bin/zot /zot
COPY --from=builder /go/src/github.com/anuvu/zot/config.yml /etc/zot/config.yml
COPY --from=builder /go/src/github.com/anuvu/zot/config.json /etc/zot/config.json
ENTRYPOINT ["/zot"]
EXPOSE 5000
VOLUME ["/var/lib/registry"]
CMD ["serve", "/etc/zot/config.yml"]
CMD ["serve", "/etc/zot/config.json"]

View file

@ -1,7 +0,0 @@
FROM golang:1.12.8
RUN go version
ENV GO111MODULE on
RUN go get -u github.com/swaggo/swag/cmd/swag
WORKDIR /go/src/github.com/anuvu/zot
RUN curl -sfL https://install.goreleaser.com/github.com/golangci/golangci-lint.sh | sh -s v1.17.1

View file

@ -5,6 +5,7 @@ COMMIT=$(if $(shell git status --porcelain --untracked-files=no),$(COMMIT_HASH)-
CONTAINER_RUNTIME := $(shell command -v podman 2> /dev/null || echo docker)
PATH := bin:$(PATH)
TMPDIR := $(shell mktemp -d)
STACKER := $(shell which stacker)
.PHONY: all
all: doc binary binary-minimal debug test check
@ -52,13 +53,16 @@ run: binary test
.PHONY: binary-container
binary-container:
${CONTAINER_RUNTIME} build ${BUILD_ARGS} -f Dockerfile.build -t zot-build:latest .
${CONTAINER_RUNTIME} build ${BUILD_ARGS} -f Dockerfile -t zot-build:latest .
.PHONY: run-container
run-container:
${CONTAINER_RUNTIME} run --rm --security-opt label=disable -v $$(pwd):/go/src/github.com/anuvu/zot \
zot-build:latest make
zot-build:latest
.PHONY: binary-stacker
binary-stacker:
stacker --roots-dir ${TMPDIR} build --substitute PWD=$$PWD
sudo ${STACKER} build --substitute PWD=$$PWD
.PHONY: image
image:

View file

@ -1,19 +1,20 @@
build:
from:
type: docker
url: docker://golang:1.14.4
url: docker://golang:1.15.3
binds:
- ${{PWD}} -> /go/src/github.com/anuvu/zot
- ${{PWD}} -> /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'
go get -u github.com/swaggo/swag/cmd/swag
mkdir -p /go/src/github.com/anuvu
cd /go/src/github.com/anuvu
git clone /zotcopy zot
cd /go/src/github.com/anuvu/zot
go get -u -v -d ./...
curl -sfL https://install.goreleaser.com/github.com/golangci/golangci-lint.sh | sh -s v1.26.0
make
make binary
build_only: true
zot: