Skip to content

Instantly share code, notes, and snippets.

@yadutaf
Last active October 10, 2024 23:19
Show Gist options
  • Save yadutaf/d9336992eb9fb2bdaab4 to your computer and use it in GitHub Desktop.
Save yadutaf/d9336992eb9fb2bdaab4 to your computer and use it in GitHub Desktop.
Run firefox in the cloud. Or inside Firefox.
FROM ubuntu:14.04
MAINTAINER Jean-Tiare Le Bigot "jt@lebigot.net"
ENV DEBIAN_FRONTEND noninteractive
# Grab all dependencies
RUN apt-get update \
&& apt-get -y upgrade \
&& apt-get -y install curl libx11-dev libxtst-dev libxcomposite-dev \
libxdamage-dev libxkbfile-dev python-all-dev \
python-gobject-dev python-gtk2-dev cython \
xvfb xauth x11-xkb-utils libx264-dev libvpx-dev \
libswscale-dev libavcodec-dev subversion websockify curl
# Grab sources, need latest version for HTML5
WORKDIR /usr/src
RUN svn co https://www.xpra.org/svn/Xpra/
# Build from sources
RUN cd Xpra/trunk/src \
&& python ./setup.py --without-csc_swscale install \
&& cd rencode \
&& python ./setup.py install \
&& curl https://bitbucket.org/pypa/setuptools/raw/bootstrap/ez_setup.py | sudo python
# Get our "demo" executable
RUN apt-get -y install firefox
# Declare ports. A real application would probably use the only one not listed: SSH
# expose HTML5 port (experimental)
EXPOSE 8080
# expose raw TCP port
EXPOSE 10000
# Create a dedicated user
RUN useradd xpra --password '*' --create-home
USER xpra
ENV HOME /home/xpra
# Run! Application will be served both as WebSocket and Raw TCP. (+ disable all unsupported bits)
CMD ["xpra", "start", ":10", "--start-child=firefox", "--daemon=off", "--bind-tcp=0.0.0.0:10000", "--html=0.0.0.0:8080", \
"--no-mdns", "--no-notifications", "--no-pulseaudio"]
@yadutaf
Copy link
Author

yadutaf commented Oct 13, 2014

Run Firefox in the cloud using Docker and Xpra. Docker is a container isolation technology, Xpra is an efficient remote application server for Linux supporting OpenGL offloading (not shown here) and Firefox is... well, you know it. Tied together, you get real private browsing.

Usage:

# Get, Build, Run
wget https://gist.githubusercontent.com/yadutaf/d9336992eb9fb2bdaab4/raw/827642194e98db2cd84f9adadcd9a0fdb8926a2b/Dockerfile
docker build -t firefox .
docker run -t --rm -p 8080:8080 -p 10000:10000 firefox

# Use!
xdg-open http://localhost:8080 # Highly experimental
xpra attach tcp:localhost:10000 # Stable, fast

More on xpra: http://xpra.org/

Feeling cloudy ? Have a look at http://labs.runabove.com/docker/ and

docker login sailabove.io
docker tag firefox sailabove.io/<you user>/firefox
docker push sailabove.io/<you user>/firefox
sail services add <your user>/firefox my-firefox

# Now running on my-firefox.<your user>.app.sailabove.io.
# Shut if off: there is *no* authentication

DISCLAIMER: This Gist is a PoC (Proof of Concept). Try it at home, not in production. You've been warned. There is no security.
LICENSE: MIT
AUTHOR: @oyadutaf (on twitter)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment