aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCody Hiar <codyfh@gmail.com>2019-02-18 20:17:47 -0700
committerCody Hiar <codyfh@gmail.com>2019-02-18 20:17:47 -0700
commit71a955a79495e09ff8a91b46f68c79e17447bd23 (patch)
tree9d9dc928f4150cc3db01e3010d1e4d241cae3750
parent0685bd8dbb6f06a4581de7cd3345571004b001c3 (diff)
Cleaning up code
-rw-r--r--.gitignore2
-rw-r--r--Makefile21
-rw-r--r--README.md34
-rw-r--r--data/.gitkeep0
-rw-r--r--docker-compose.yml23
-rwxr-xr-xrun.sh24
6 files changed, 68 insertions, 36 deletions
diff --git a/.gitignore b/.gitignore
new file mode 100644
index 0000000..06b2ab9
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1,2 @@
+data/*
+!data/.gitkeep
diff --git a/Makefile b/Makefile
new file mode 100644
index 0000000..accd178
--- /dev/null
+++ b/Makefile
@@ -0,0 +1,21 @@
+.PHONY: build
+
+help:
+ @grep -E '^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | sort | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-30s\033[0m %s\n", $$1, $$2}'
+
+build: ## Build the Docker image
+ docker-compose -p firefox build
+
+up: build ## Bring the container up
+ xhost local:1000
+ docker-compose -p firefox up -d
+
+down: ## Stop the container
+ docker-compose -p firefox stop
+
+enter: ## Enter the running container
+ docker-compose -p firefox exec backend /bin/bash
+
+clean: down ## Remove stoped containers
+ docker-compose -p firefox rm
+
diff --git a/README.md b/README.md
index e994c52..e255a54 100644
--- a/README.md
+++ b/README.md
@@ -1,13 +1,19 @@
-Sound in Container: https://github.com/mviereck/x11docker/wiki/Container-sound:-ALSA-or-Pulseaudio
+# Firefox in a Docker Container
-Create socket:
+This is my project for running in a container.
+
+## Getting sound from the container using Pulse
+
+[source][1]
+
+
+Step 1: Create socket
```
pactl load-module module-native-protocol-unix socket=/tmp/pulseaudio.socket
```
-
-create `/tmp/pulseaudio.client.conf` with:
+Step 2: Create client config file `/tmp/pulseaudio.client.conf` with contents
```
default-server = unix:/tmp/pulseaudio.socket
@@ -18,14 +24,18 @@ daemon-binary = /bin/true
enable-shm = false
```
-Share pulse stuff
+Step 3: Now run `make up` and your firefox container should start running
+
+
+## Tabs contantly crashing
+
+You can disable multi-process windows in Firefox by setting these prefs to
+false on the `about:config` page.
```
-docker run --rm \
- --env PULSE_SERVER=unix:/tmp/pulseaudio.socket \
- --env PULSE_COOKIE=/tmp/pulseaudio.cookie \
- --volume /tmp/pulseaudio.socket:/tmp/pulseaudio.socket \
- --volume /tmp/pulseaudio.client.conf:/etc/pulse/client.conf \
- --user $(id -u):$(id -g) \
- imagename
+browser.tabs.remote.autostart = false
```
+
+
+
+[1]: https://github.com/mviereck/x11docker/wiki/Container-sound:-ALSA-or-Pulseaudio
diff --git a/data/.gitkeep b/data/.gitkeep
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/data/.gitkeep
diff --git a/docker-compose.yml b/docker-compose.yml
new file mode 100644
index 0000000..cc7dae7
--- /dev/null
+++ b/docker-compose.yml
@@ -0,0 +1,23 @@
+version: '3'
+services:
+ backend:
+ build:
+ context: ./
+ dockerfile: ./Dockerfile
+ network_mode: "bridge"
+ container_name: firefox
+ image: thornycrackers/firefox
+ environment:
+ - DISPLAY=unix:0
+ - PULSE_SERVER=unix:/tmp/pulseaudio.socket
+ - PULSE_COOKIE=/tmp/pulseaudio.cookie
+ volumes:
+ - /tmp/.X11-unix:/tmp/.X11-unix
+ - /tmp/pulseaudio.socket:/tmp/pulseaudio.socket
+ - /tmp/pulseaudio.client.conf:/etc/pulse/client.conf
+ - /etc/localtime:/etc/localtime:ro
+ - ./data:/home/thorny/.mozilla
+ command: /bin/bash firefox
+ tty: true
+ stdin_open: true
+
diff --git a/run.sh b/run.sh
deleted file mode 100755
index d67f615..0000000
--- a/run.sh
+++ /dev/null
@@ -1,24 +0,0 @@
-
-# docker run --rm \
-# --user $(id -u):$(id -g) \
-
-
-# Error with container opening socket
-# https://github.com/jessfraz/dockerfiles/issues/4
-
-
-docker build -t firefox .
-
-xhost local:root
-
-docker run -it \
- --rm \
- -v /tmp/.X11-unix:/tmp/.X11-unix \
- -e DISPLAY=unix"$DISPLAY" \
- --env PULSE_SERVER=unix:/tmp/pulseaudio.socket \
- --env PULSE_COOKIE=/tmp/pulseaudio.cookie \
- --volume /tmp/pulseaudio.socket:/tmp/pulseaudio.socket \
- --volume /tmp/pulseaudio.client.conf:/etc/pulse/client.conf \
- --volume /etc/localtime:/etc/localtime:ro \
- --name firefox \
- firefox