Dockerfile 2.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182
  1. # Allow the Browsh image version to be injected via the command line during build
  2. ARG BROWSH_IMAGE_TAG
  3. # First build our custom SSH server
  4. # The Browsh SSH server is a custom Go server that launches Browsh upon a successful
  5. # SSH connection.
  6. FROM bitnami/minideb:bullseye
  7. RUN install_packages \
  8. curl \
  9. ca-certificates \
  10. git \
  11. autoconf \
  12. automake \
  13. g++ \
  14. protobuf-compiler \
  15. zlib1g-dev \
  16. libncurses5-dev \
  17. libssl-dev \
  18. pkg-config \
  19. libprotobuf-dev \
  20. make
  21. # Install Golang to build the custom Browsh SSH server
  22. ENV GOPATH=/go
  23. ENV GOROOT=$GOPATH
  24. ENV PATH=$GOPATH/bin:$PATH
  25. RUN curl -L -o go.tar.gz https://dl.google.com/go/go1.9.2.linux-amd64.tar.gz
  26. RUN mkdir -p $GOPATH/bin
  27. RUN mkdir -p $GOPATH/src/browsh_ssh_server
  28. RUN tar -C / -xzf go.tar.gz
  29. # Install a bleeding edge version of Mosh for true colour support
  30. RUN git clone https://github.com/mobile-shell/mosh
  31. RUN cd mosh && git checkout 10dca75fb21ce2e3b
  32. RUN cd mosh && ./autogen.sh && ./configure && make && make install
  33. # Install `dep` the current defacto dependency manager for Golang
  34. ENV GOLANG_DEP_VERSION=0.3.2
  35. ENV dep_url=https://github.com/golang/dep/releases/download/v$GOLANG_DEP_VERSION/dep-linux-amd64
  36. RUN curl -L -o $GOPATH/bin/dep $dep_url
  37. RUN chmod +x $GOPATH/bin/dep
  38. WORKDIR $GOPATH/src/browsh_ssh_server
  39. ADD . $GOPATH/src/browsh_ssh_server
  40. RUN dep ensure
  41. RUN go build -o browsh-ssh-server ssh-server.go
  42. # Now wrap the SSH server image around the original Browsh Docker image
  43. FROM browsh/browsh:v1.8.0
  44. # Copy the SSH server built in the previous stage.
  45. COPY --from=0 /go/src/browsh_ssh_server/browsh-ssh-server /usr/local/bin
  46. COPY --from=0 /usr/local/bin/mosh-server /usr/local/bin
  47. USER root
  48. RUN install_packages \
  49. xvfb \
  50. libgtk-3-0 \
  51. curl \
  52. ca-certificates \
  53. libdbus-glib-1-2 \
  54. procps \
  55. libasound2 \
  56. libxtst6
  57. USER user
  58. ADD start-browsh-session.sh /usr/local/bin/
  59. RUN ln -s /app/bin/browsh /app/browsh; ln -s /app/bin/firefox /app/firefox
  60. RUN touch /app/debug.log && echo "Browsh logs start" > /app/debug.log
  61. # Firefox behaves quite differently to normal on its first run, so by getting
  62. # that over and done with here when there's no user to be dissapointed means
  63. # that all future runs will be consistent.
  64. RUN TERM=xterm script \
  65. --return \
  66. -c "/app/bin/browsh" \
  67. /dev/null \
  68. >/dev/null & \
  69. sleep 10
  70. CMD browsh-ssh-server -host-key /etc/browsh/id_rsa & touch /app/debug.log && tail -f /app/debug.log