Dockerfile.minimal 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. # dockerfile for "interactive" minimal 3proxy execution, no configuration mounting is required, configuration
  2. # is accepted from stdin. Use "end" command to indicate the end of configuration. Use "log" for stdout logging.
  3. #
  4. # This is busybox based docker with only 3proxy static executable and empty non-writable "run" directory.
  5. #
  6. # "plugin" is not supported
  7. #
  8. # Build:
  9. #
  10. # docker build -f Dockerfile.minimal -t 3proxy.minimal .
  11. #
  12. # Run example:
  13. #
  14. # docker run -i -p 3129:3129 --name 3proxy 3proxy.minimal
  15. #or
  16. # docker start -i 3proxy
  17. #<chroot run 65535 65535
  18. #<nserver 8.8.8.8
  19. #<nscache 65535
  20. #<log
  21. #<proxy -p3129
  22. #<end
  23. #
  24. # use "chroot run 65536 65536" in config for safe chroot environment. nserver is required for DNS resolutions in chroot.
  25. FROM gcc AS buildenv
  26. COPY . /3proxy
  27. RUN cd /3proxy &&\
  28. echo "">>Makefile.Linux&&\
  29. echo LDFLAGS = -fPIE -O2 -fno-strict-aliasing -pthread >>Makefile.Linux&&\
  30. echo PLUGINS = >>Makefile.Linux&&\
  31. echo LIBS = >>Makefile.Linux&&\
  32. 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&&\
  33. make -f Makefile.Linux&&\
  34. strip bin/3proxy
  35. FROM busybox:glibc
  36. COPY --from=buildenv /3proxy/bin/3proxy /bin/3proxy
  37. RUN mkdir /run && chmod 555 /run
  38. CMD ["/bin/3proxy"]