Dockerfile 1.9 KB

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