Dockerfile 1.8 KB

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