forked from elastic/package-registry
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile
38 lines (26 loc) · 1.05 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.18.3
FROM golang:${GO_VERSION} AS builder
COPY ./ /package-registry
WORKDIR /package-registry
RUN go build .
# Run binary
FROM ubuntu:22.04
# Get dependencies
RUN apt-get update && \
apt-get install -y media-types zip rsync curl && \
rm -rf /var/lib/apt/lists/*
# 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
ENV EPR_ADDRESS=0.0.0.0:8080
HEALTHCHECK --interval=1s --retries=30 CMD curl --silent --fail localhost:8080/health || exit 1