0
Fork 0
mirror of https://github.com/project-zot/zot.git synced 2024-12-30 22:34:13 -05:00

Add new Dockerfile and README instructions

Signed-off-by: Josh Dolitsky <393494+jdolitsky@users.noreply.github.com>
This commit is contained in:
Josh Dolitsky 2020-01-24 11:54:38 -06:00
parent d50a07c149
commit dfd8b84344
3 changed files with 72 additions and 1 deletions

27
Dockerfile Normal file
View file

@ -0,0 +1,27 @@
# ---
# 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
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
# ---
# 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 /zot
COPY --from=builder /go/src/github.com/anuvu/zot/config.yml /etc/zot/config.yml
ENTRYPOINT ["/zot"]
EXPOSE 5000
VOLUME ["/var/lib/registry"]
CMD ["serve", "/etc/zot/config.yml"]

View file

@ -50,3 +50,7 @@ binary-container:
.PHONY: binary-stacker
binary-stacker:
stacker build --substitute PWD=$$PWD --no-cache
.PHONY: image
image:
${CONTAINER_RUNTIME} build ${BUILD_ARGS} -f Dockerfile -t zot:latest .

View file

@ -42,18 +42,58 @@ make binary-stacker
```
make
```
Build artifacts are in bin/
# Serving
```
bin/zot serve _config-file_
```
Examples of config files are available in [examples/](examples/) dir.
# Container Image
The [Dockerfile](./Dockerfile) in this repo can be used to build a container image
that runs _zot_.
To build the image:
```
make image
```
Then run the image with your preferred container runtime:
```
# with podman
podman run --rm -p 5000:5000 \
-v $(pwd)/registry:/var/lib/registry \
zot:latest
# with docker
docker run --rm -p 5000:5000 \
-v $(pwd)/registry:/var/lib/registry \
zot:latest
```
By default, the server will use no auth, listen on port 5000,
and store content at `/var/lib/registry`.
If you wish use custom configuration settings, you can override
the YAML config file located at `/etc/zot/config.yml`:
```
# Example: using a local file "custom-config.yml" that
# listens on port 8080 and uses /tmp/zot for storage
podman run --rm -p 8080:8080 \
-v $(pwd)/custom-config.yml:/etc/zot/config.yml \
-v $(pwd)/registry:/tmp/zot \
zot:latest
```
# Ecosystem
Since we couldn't find clients or client libraries that are stictly compliant to