From 20764074cb2b2e0c4fd36b51f9dfc911b6f46a45 Mon Sep 17 00:00:00 2001 From: Olliver Schinagl Date: Mon, 5 Jun 2023 22:02:34 +0200 Subject: [PATCH] docker: Improve caching layers Docker is most efficient if you can 'order' the layers from least-changing to most changing to improve on cache hits. While here, change ADD to COPY as add is really intended to download external packages, as well as installing sslh into a proper location. Signed-off-by: Olliver Schinagl --- Dockerfile | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/Dockerfile b/Dockerfile index 487fe7f..f87313c 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,7 +1,8 @@ FROM alpine:latest as build -ADD . /sslh +WORKDIR /sslh +COPY . /sslh RUN \ apk add \ gcc \ @@ -10,14 +11,13 @@ RUN \ musl-dev \ pcre2-dev \ perl && \ - cd /sslh && \ make sslh-select && \ strip sslh-select FROM alpine:latest -COPY --from=build /sslh/sslh-select /sslh +COPY --from=build "/sslh/sslh-select" "/usr/local/bin/sslh" RUN apk --no-cache add libconfig pcre2 -ENTRYPOINT [ "/sslh", "--foreground"] +ENTRYPOINT [ "/usr/local/bin/sslh", "--foreground" ]