-
Notifications
You must be signed in to change notification settings - Fork 370
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
faster and more efficient docker file
- Loading branch information
Showing
1 changed file
with
32 additions
and
23 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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"] |