-
Notifications
You must be signed in to change notification settings - Fork 67
/
Dockerfile
45 lines (30 loc) · 1.24 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
38
39
40
41
42
43
44
# 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
ARG GO_VERSION
ARG BUILDER_IMAGE=golang
ARG RUNNER_IMAGE=cgr.dev/chainguard/wolfi-base
# Build binary
FROM --platform=${BUILDPLATFORM:-linux} ${BUILDER_IMAGE}:${GO_VERSION} AS builder
COPY ./ /package-registry
WORKDIR /package-registry
ARG TARGETPLATFORM
RUN make release-${TARGETPLATFORM:-linux}
# Run binary
FROM ${RUNNER_IMAGE}
# Get dependencies
# Mailcap is installed to get mime types information.
RUN apk update && \
apk add mailcap zip rsync curl && \
rm -rf /var/cache/apk/*
# 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