Skip to content

Commit

Permalink
Merge pull request #419 from ffranr/docker_image_layer_split
Browse files Browse the repository at this point in the history
docker: perform dependencies installation in separate run layer
  • Loading branch information
guggero authored Nov 15, 2022
2 parents e65f78d + 6a8a2ce commit ef9dd9a
Showing 1 changed file with 6 additions and 9 deletions.
15 changes: 6 additions & 9 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,21 +1,18 @@
FROM --platform=${BUILDPLATFORM} golang:1.18.5-alpine as builder

# Copy in the local repository to build from.
COPY . /go/src/github.com/lightninglabs/pool

# 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 and install/build pool.
RUN apk add --no-cache --update alpine-sdk \
git \
make \
&& cd /go/src/github.com/lightninglabs/pool \
&& make install
# 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
Expand Down

0 comments on commit ef9dd9a

Please sign in to comment.