diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 00000000..39f071ff --- /dev/null +++ b/Dockerfile @@ -0,0 +1,44 @@ +# +# build by: docker build -t sniproxy . +# + +FROM ubuntu:20.04 AS builder + +ENV DEBIAN_FRONTEND noninteractive + +# Build Stage +RUN apt-get update && \ + apt-get install -y \ + autotools-dev \ + cdbs \ + debhelper \ + dh-autoreconf \ + dpkg-dev \ + gettext \ + libev-dev \ + libpcre3-dev \ + libudns-dev \ + pkg-config \ + fakeroot \ + devscripts && \ + mkdir -p /sniproxy + +COPY . /sniproxy/ + +RUN cd /sniproxy && \ + ./autogen.sh && \ + dpkg-buildpackage + + + +# Usage +FROM ubuntu:20.04 + +COPY --from=builder /*.deb /tmp/ + +RUN apt-get update && \ + apt install -y --no-install-recommends /tmp/sniproxy_*.deb && \ + rm -f /tmp/sniproxy_*.deb + +ENTRYPOINT ["sniproxy", "-f"] +EXPOSE 80 443 diff --git a/README.md b/README.md index 2cf1b124..0ca0cdb2 100644 --- a/README.md +++ b/README.md @@ -17,7 +17,7 @@ Features + Supports HAProxy proxy protocol to propagate original source address to backend servers. -Usage +Usage: Binary ----- Usage: sniproxy [-c ] [-f] [-n ] [-V] @@ -26,6 +26,16 @@ Usage -n specify file descriptor limit -V print the version of SNIProxy and exit +Usage: Docker +----- + + docker build -t sniproxy . + + docker run \ + -it \ + --network host \ + --volume /etc/sniproxy.conf:/etc/sniproxy.conf:ro \ + sniproxy:latest -c /etc/sniproxy.conf Installation ------------