mirror of
https://github.com/3proxy/3proxy.git
synced 2025-02-23 10:35:40 +08:00
Update dockerfiles
This commit is contained in:
parent
c5abe51e26
commit
336a4acd46
55
Dockerfile.full
Normal file
55
Dockerfile.full
Normal file
@ -0,0 +1,55 @@
|
|||||||
|
# 3proxy.full is fully functional 3proxy build based on busibox:glibc
|
||||||
|
#
|
||||||
|
#to build:
|
||||||
|
# docker build -f Dockerfile.full -t 3proxy.full .
|
||||||
|
#to run:
|
||||||
|
# by default 3proxy uses safe chroot environment with chroot to /usr/local/3proxy with uid/gid 65535/65535 and expects
|
||||||
|
# configuration file to be placed in /usr/local/etc/3proxy.
|
||||||
|
# Paths in configuration file must be relative to /usr/local/3proxy, that is use /logs instead of
|
||||||
|
# /usr/local/3proxy/logs. nserver in chroot is required for DNS resolution. An example:
|
||||||
|
#
|
||||||
|
# echo nserver 8.8.8.8 >/path/to/local/config/directory/3proxy.cfg
|
||||||
|
# echo proxy -p3129 >>/path/to/local/config/directory/3proxy.cfg
|
||||||
|
# docker run -p 3129:3129 -v /path/to/local/config/directory:/usr/local/3proxy/conf -name 3proxy.full 3proxy.full
|
||||||
|
#
|
||||||
|
# /path/to/local/config/directory in this example must conrain 3proxy.cfg
|
||||||
|
# if you need 3proxy to be executed without chroot with root permissions, replace /etc/3proxy/3proxy.cfg by e.g. mounting config
|
||||||
|
# dir to /etc/3proxy ot by providing config file /etc/3proxy/3proxy.cfg
|
||||||
|
# docker run -p 3129:3129 -v /path/to/local/config/directory:/etc/3proxy -name 3proxy.full 3proxy.full
|
||||||
|
#
|
||||||
|
# use "log" without pathname in config to log to stdout.
|
||||||
|
# plugins are located in /usr/local/3proxy/libexec (/libexec for chroot config).
|
||||||
|
|
||||||
|
|
||||||
|
FROM gcc AS buildenv
|
||||||
|
COPY . 3proxy
|
||||||
|
RUN cd 3proxy &&\
|
||||||
|
echo "">> Makefile.Linux &&\
|
||||||
|
echo PLUGINS = StringsPlugin TrafficPlugin PCREPlugin TransparentPlugin SSLPlugin>>Makefile.Linux &&\
|
||||||
|
echo LIBS = -l:libcrypto.a -l:libssl.a -ldl >>Makefile.Linux &&\
|
||||||
|
make -f Makefile.Linux &&\
|
||||||
|
strip bin/3proxy &&\
|
||||||
|
strip bin/StringsPlugin.ld.so &&\
|
||||||
|
strip bin/TrafficPlugin.ld.so &&\
|
||||||
|
strip bin/PCREPlugin.ld.so &&\
|
||||||
|
strip bin/TransparentPlugin.ld.so &&\
|
||||||
|
strip bin/SSLPlugin.ld.so
|
||||||
|
|
||||||
|
FROM busybox:glibc
|
||||||
|
COPY --from=buildenv /lib/x86_64-linux-gnu/libdl.so.* /lib/
|
||||||
|
COPY --from=buildenv 3proxy/bin/3proxy /bin/
|
||||||
|
COPY --from=buildenv 3proxy/bin/*.ld.so /usr/local/3proxy/libexec/
|
||||||
|
RUN mkdir /usr/local/3proxy/logs &&\
|
||||||
|
mkdir /usr/local/3proxy/conf &&\
|
||||||
|
chown -R 65535:65535 /usr/local/3proxy &&\
|
||||||
|
chmod -R 550 /usr/local/3proxy &&\
|
||||||
|
chmod 750 /usr/local/3proxy/logs &&\
|
||||||
|
chmod -R 555 /usr/local/3proxy/libexec &&\
|
||||||
|
chown -R root /usr/local/3proxy/libexec &&\
|
||||||
|
mkdir /etc/3proxy/ &&\
|
||||||
|
echo chroot /usr/local/3proxy 65535 65535 >/etc/3proxy/3proxy.cfg &&\
|
||||||
|
echo include /conf/3proxy.cfg >>/etc/3proxy/3proxy.cfg &&\
|
||||||
|
chmod 440 /etc/3proxy/3proxy.cfg
|
||||||
|
|
||||||
|
|
||||||
|
CMD ["/bin/3proxy", "/etc/3proxy/3proxy.cfg"]
|
@ -1,10 +1,9 @@
|
|||||||
# dockerfile for "interactive" minimal 3proxy execution, no configuration mounting is required, configuration
|
# 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.
|
# is accepted from stdin. Use "end" command to indicate the end of configuration. Use "log" for stdout logging.
|
||||||
# nserver is required for DNS resolutions (system resolver will not work).
|
|
||||||
#
|
#
|
||||||
# This is "scratch" docker with only 3proxy static executable and empty non-writable "run" directory.
|
# This is busybox based docker with only 3proxy static executable and empty non-writable "run" directory.
|
||||||
#
|
#
|
||||||
# "plugin" and "system" are not supported
|
# "plugin" is not supported
|
||||||
#
|
#
|
||||||
# Build:
|
# Build:
|
||||||
#
|
#
|
||||||
@ -22,22 +21,22 @@
|
|||||||
#<proxy -p3129
|
#<proxy -p3129
|
||||||
#<end
|
#<end
|
||||||
#
|
#
|
||||||
# use "chroot run 65536 65536" in config for safe chroot environment
|
# use "chroot run 65536 65536" in config for safe chroot environment. nserver is required for DNS resolutions in chroot.
|
||||||
|
|
||||||
|
|
||||||
FROM gcc AS buildenv
|
FROM gcc AS buildenv
|
||||||
COPY . /3proxy
|
COPY . /3proxy
|
||||||
RUN cd /3proxy &&\
|
RUN cd /3proxy &&\
|
||||||
echo "">>Makefile.Linux&&\
|
echo "">>Makefile.Linux&&\
|
||||||
echo LDFLAGS = -fPIE -static -O2 -fno-strict-aliasing -pthread >>Makefile.Linux&&\
|
echo LDFLAGS = -fPIE -O2 -fno-strict-aliasing -pthread >>Makefile.Linux&&\
|
||||||
echo PLUGINS = >>Makefile.Linux&&\
|
echo PLUGINS = >>Makefile.Linux&&\
|
||||||
|
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&&\
|
||||||
make -f Makefile.Linux&&\
|
make -f Makefile.Linux&&\
|
||||||
cp bin/3proxy .&&\
|
strip bin/3proxy
|
||||||
strip 3proxy&&\
|
|
||||||
mkdir run&&\
|
|
||||||
chmod 555 run
|
|
||||||
|
|
||||||
FROM scratch
|
|
||||||
COPY --from=buildenv 3proxy .
|
FROM busybox:glibc
|
||||||
COPY --from=buildenv run .
|
COPY --from=buildenv /3proxy/bin/3proxy /bin/3proxy
|
||||||
CMD ["./3proxy"]
|
RUN mkdir /run && chmod 555 /run
|
||||||
|
CMD ["/bin/3proxy"]
|
||||||
|
Loading…
Reference in New Issue
Block a user