diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..cb8de3a --- /dev/null +++ b/Dockerfile @@ -0,0 +1,23 @@ +FROM alpine:latest as build + +ADD . /sslh + +RUN \ + apk add \ + gcc \ + libconfig-dev \ + make \ + musl-dev \ + pcre-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 pcre + +ENTRYPOINT [ "/sslh", "--foreground"] diff --git a/Makefile b/Makefile index 454fbd0..1c465fe 100644 --- a/Makefile +++ b/Makefile @@ -103,6 +103,15 @@ release: git archive master --prefix="sslh-$(VERSION)/" | gzip > /tmp/sslh-$(VERSION).tar.gz gpg --detach-sign --armor /tmp/sslh-$(VERSION).tar.gz +# Build docker image +docker: + docker image build -t "sslh:${VERSION}" . + docker image tag "sslh:${VERSION}" sslh:latest + +docker-clean: + yes | docker image rm "sslh:${VERSION}" sslh:latest + yes | docker image prune + # generic install: install binary and man page install: sslh $(MAN) mkdir -p $(DESTDIR)/$(BINDIR) diff --git a/README.md b/README.md index 802076b..2c391fa 100644 --- a/README.md +++ b/README.md @@ -37,6 +37,54 @@ Please refer to the [configuration guide](doc/config.md). +Docker image +------------ + +How to use + +--- + +Build docker image + + make docker + + +```bash +docker container run \ + --rm \ + -it \ + --listen=0.0.0.0:443 \ + --ssh=hostname:22 \ + --tlshostname:443 \ + sslh:latest +``` + +docker-compose example + +``` +--- +version: "3" + +services: + sslh: + image: sslh:latest + hostname: sslh + ports: + - 443:443/tcp + command: --listen=0.0.0.0:443 --tlshostname:443 --openvpn=openvpn:1194 + depends_on: + - nginx + - openvpn + + nginx: + image: nginx + hostname: nginx + + openvpn: + image: openvpn:latest + hostname: openvpn +``` + Comments? Questions? ====================