mirror of
https://github.com/lightninglabs/pool.git
synced 2026-08-16 13:00:39 +02:00
This commit separates the task of dependencies installation into its own separate run layer. Previously, dependencies installation shared the same layer as local repo build. This change means that the dependencies run layer can be reused (cached) whilst the local repo is modified. Which is helpful for regtests.
32 lines
926 B
Docker
32 lines
926 B
Docker
FROM --platform=${BUILDPLATFORM} golang:1.18.5-alpine as builder
|
|
|
|
# Force Go to use the cgo based DNS resolver. This is required to ensure DNS
|
|
# queries required to connect to linked containers succeed.
|
|
ENV GODEBUG netdns=cgo
|
|
|
|
# Explicitly turn on the use of modules (until this becomes the default).
|
|
ENV GO111MODULE on
|
|
|
|
# Install dependencies.
|
|
RUN apk add --no-cache --update alpine-sdk git make
|
|
|
|
# Build and install both pool binaries (daemon and CLI).
|
|
COPY . /go/src/github.com/lightninglabs/pool
|
|
RUN cd /go/src/github.com/lightninglabs/pool && make install
|
|
|
|
# Start a new, final image to reduce size.
|
|
FROM --platform=${BUILDPLATFORM} alpine as final
|
|
|
|
# Expose poold ports (gRPC and REST).
|
|
EXPOSE 12010 8281
|
|
|
|
# Copy the binaries from the builder image.
|
|
COPY --from=builder /go/bin/pool /bin/
|
|
COPY --from=builder /go/bin/poold /bin/
|
|
|
|
# Add bash.
|
|
RUN apk add --no-cache \
|
|
bash \
|
|
ca-certificates
|
|
|
|
ENTRYPOINT ["poold"]
|