Dockerfile.minimal 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  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. # nserver is required for DNS resolutions (system resolver will not work).
  4. #
  5. # This is "scratch" docker with only 3proxy static executable and empty non-writable "run" directory.
  6. #
  7. # "plugin" and "system" are not supported
  8. #
  9. # Build:
  10. #
  11. # docker build -f Dockerfile.minimal -t 3proxy.minimal .
  12. #
  13. # Run example:
  14. #
  15. # docker run -i -p 3129:3129 --name 3proxy 3proxy.minimal
  16. #or
  17. # docker start -i 3proxy
  18. #<chroot run 65535 65535
  19. #<nserver 8.8.8.8
  20. #<nscache 65535
  21. #<log
  22. #<proxy -p3129
  23. #<end
  24. #
  25. # use "chroot run 65536 65536" in config for safe chroot environment
  26. FROM gcc AS buildenv
  27. COPY . /3proxy
  28. RUN cd /3proxy &&\
  29. echo "">>Makefile.Linux&&\
  30. echo LDFLAGS = -fPIE -static -O2 -fno-strict-aliasing -pthread >>Makefile.Linux&&\
  31. echo PLUGINS = >>Makefile.Linux&&\
  32. make -f Makefile.Linux&&\
  33. cp bin/3proxy .&&\
  34. strip 3proxy&&\
  35. mkdir run&&\
  36. chmod 555 run
  37. FROM scratch
  38. COPY --from=buildenv 3proxy .
  39. COPY --from=buildenv run .
  40. CMD ["./3proxy"]