Skip to content

Commit

Permalink
faster and more efficient docker file
Browse files Browse the repository at this point in the history
  • Loading branch information
falahati committed Nov 17, 2022
1 parent b928216 commit 70c8974
Showing 1 changed file with 32 additions and 23 deletions.
55 changes: 32 additions & 23 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,23 +1,32 @@
FROM alpine:latest as build

ADD . /sslh

RUN \
apk add \
gcc \
libconfig-dev \
make \
musl-dev \
pcre2-dev \
perl && \
cd /sslh && \
make sslh-select && \
strip sslh-select

FROM alpine:latest

COPY --from=build /sslh/sslh-select /sslh

RUN apk --no-cache add libconfig pcre2

ENTRYPOINT [ "/sslh", "--foreground"]
##########################################################################################
## BUILD APPLICATION
##########################################################################################
FROM alpine:latest as build

# install required packages first to be able to take advantage of caching
RUN apk add \
gcc \
libconfig-dev \
make \
musl-dev \
pcre2-dev \
perl

# copy files and build the app
WORKDIR /sslh
ADD . .
RUN make sslh-select && \
strip sslh-select


##########################################################################################
## PACKAGE APPLICATION
##########################################################################################
FROM alpine:latest

# install required packages first and in parallel with the build container execution
RUN apk --no-cache add libconfig pcre2

# copy the final executable from the build container
COPY --from=build /sslh/sslh-select /sslh
ENTRYPOINT [ "/sslh", "--foreground"]

0 comments on commit 70c8974

Please sign in to comment.