forked from elastic/package-registry
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile
38 lines (26 loc) · 1.09 KB
/
Dockerfile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
# This image contains the package-registry binary.
# It expects packages to be mounted under /packages/package-registry or have a config file loaded into /package-registry/config.yml
# Build binary
ARG GO_VERSION=1.16.7
FROM golang:${GO_VERSION} AS builder
ENV GO111MODULE=on
COPY ./ /package-registry
WORKDIR /package-registry
RUN go build .
# Run binary
FROM centos:7
# Get dependencies
# mailcap - installs "/etc/mime.types" used by the package-registry binary
RUN yum install -y zip rsync mailcap && yum clean all
# Move binary from the builder image
COPY --from=builder /package-registry/package-registry /package-registry/package-registry
# Change to new working directory
WORKDIR /package-registry
# Get in config which expects packages in /packages
COPY config.docker.yml /package-registry/config.yml
# Start registry when container is run an expose it on port 8080
EXPOSE 8080
ENTRYPOINT ["./package-registry"]
# Make sure it's accessible from outside the container
CMD ["--address=0.0.0.0:8080"]
HEALTHCHECK --interval=1s --retries=30 CMD curl --silent --fail localhost:8080/health || exit 1