Dockerfile 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182
  1. FROM bitnami/minideb:bullseye as build
  2. RUN install_packages \
  3. curl \
  4. ca-certificates \
  5. git \
  6. autoconf \
  7. automake \
  8. g++ \
  9. protobuf-compiler \
  10. zlib1g-dev \
  11. libncurses5-dev \
  12. libssl-dev \
  13. pkg-config \
  14. libprotobuf-dev \
  15. make \
  16. bzip2
  17. # Helper scripts
  18. WORKDIR /build
  19. ADD .git .git
  20. ADD .github .github
  21. ADD scripts scripts
  22. ADD ctl.sh .
  23. # Install Golang and Browsh
  24. ENV GOROOT=/go
  25. ENV GOPATH=/go-home
  26. ENV PATH=$GOROOT/bin:$GOPATH/bin:$PATH
  27. ENV BASE=$GOPATH/src/browsh/interfacer
  28. ADD interfacer $BASE
  29. WORKDIR $BASE
  30. RUN /build/ctl.sh install_golang $BASE
  31. RUN /build/ctl.sh build_browsh_binary $BASE
  32. ###########################
  33. # Actual final Docker image
  34. ###########################
  35. FROM bitnami/minideb:bullseye
  36. ENV HOME=/app
  37. WORKDIR $HOME
  38. COPY --from=build /go-home/src/browsh/interfacer/browsh /app/bin/browsh
  39. RUN install_packages \
  40. xvfb \
  41. libgtk-3-0 \
  42. curl \
  43. ca-certificates \
  44. libdbus-glib-1-2 \
  45. procps \
  46. libasound2 \
  47. libxtst6 \
  48. firefox-esr
  49. # Block ads, etc. This includes porn just because this image is also used on the
  50. # public SSH demo: `ssh brow.sh`.
  51. RUN curl \
  52. -o /etc/hosts \
  53. https://raw.githubusercontent.com/StevenBlack/hosts/master/alternates/fakenews-gambling-porn-social/hosts
  54. # Don't use root
  55. RUN useradd -m user --home /app
  56. RUN chown user:user /app
  57. USER user
  58. ENV PATH="${HOME}/bin:${HOME}/bin/firefox:${PATH}"
  59. # Firefox behaves quite differently to normal on its first run, so by getting
  60. # that over and done with here when there's no user to be dissapointed means
  61. # that all future runs will be consistent.
  62. RUN TERM=xterm script \
  63. --return \
  64. -c "/app/bin/browsh" \
  65. /dev/null \
  66. >/dev/null & \
  67. sleep 10
  68. ENTRYPOINT ["/app/bin/browsh"]