3proxy/Dockerfile.minimal

43 lines
1.4 KiB
Docker
Raw Normal View History

2020-11-27 20:21:05 +08:00
# dockerfile for "interactive" minimal 3proxy execution, no configuration mounting is required, configuration
# is accepted from stdin. Use "end" command to indicate the end of configuration. Use "log" for stdout logging.
#
2020-11-28 07:44:50 +08:00
# This is busybox based docker with only 3proxy static executable and empty non-writable "run" directory.
2020-11-27 20:21:05 +08:00
#
2020-11-28 07:44:50 +08:00
# "plugin" is not supported
2020-11-27 20:21:05 +08:00
#
# Build:
#
# docker build -f Dockerfile.minimal -t 3proxy.minimal .
#
# Run example:
#
# docker run -i -p 3129:3129 --name 3proxy 3proxy.minimal
#or
# docker start -i 3proxy
#<chroot run 65535 65535
#<nserver 8.8.8.8
#<nscache 65535
#<log
#<proxy -p3129
#<end
#
2020-11-28 07:44:50 +08:00
# use "chroot run 65536 65536" in config for safe chroot environment. nserver is required for DNS resolutions in chroot.
2020-11-27 20:21:05 +08:00
FROM gcc AS buildenv
COPY . /3proxy
RUN cd /3proxy &&\
echo "">>Makefile.Linux&&\
2020-11-28 07:44:50 +08:00
echo LDFLAGS = -fPIE -O2 -fno-strict-aliasing -pthread >>Makefile.Linux&&\
2020-11-27 20:21:05 +08:00
echo PLUGINS = >>Makefile.Linux&&\
2020-11-28 07:44:50 +08:00
echo LIBS = >>Makefile.Linux&&\
echo CFLAGS = -g -fPIC -O2 -fno-strict-aliasing -c -pthread -DWITHSPLICE -D_GNU_SOURCE -DGETHOSTBYNAME_R -D_THREAD_SAFE -D_REENTRANT -DNOODBC -DWITH_STD_MALLOC -DFD_SETSIZE=4096 -DWITH_POLL -DWITH_NETFILTER -DNOPLUGINS >>Makefile.Linux&&\
2020-11-27 20:21:05 +08:00
make -f Makefile.Linux&&\
2020-11-28 07:44:50 +08:00
strip bin/3proxy
2020-11-27 20:21:05 +08:00
2020-11-28 07:44:50 +08:00
FROM busybox:glibc
COPY --from=buildenv /3proxy/bin/3proxy /bin/3proxy
RUN mkdir /run && chmod 555 /run
CMD ["/bin/3proxy"]