├── steambox ├── .dockerignore ├── show_motd ├── bootstrap_steamdeps.txt ├── Dockerfile └── Makefile ├── steambox_ati ├── .dockerignore ├── Dockerfile ├── Dockerfile.1 └── Makefile ├── steambox_nvidia ├── .dockerignore ├── Dockerfile └── Makefile ├── steamos_buildmach ├── .dockerignore ├── Makefile └── Dockerfile ├── .gitignore ├── util ├── rmdi ├── rmec └── steambox ├── Makefile ├── functs.mk └── README.md /steambox/.dockerignore: -------------------------------------------------------------------------------- 1 | Makefile 2 | *.built 3 | -------------------------------------------------------------------------------- /steambox_ati/.dockerignore: -------------------------------------------------------------------------------- 1 | Makefile 2 | *.built 3 | -------------------------------------------------------------------------------- /steambox_nvidia/.dockerignore: -------------------------------------------------------------------------------- 1 | Makefile 2 | *.built 3 | -------------------------------------------------------------------------------- /steamos_buildmach/.dockerignore: -------------------------------------------------------------------------------- 1 | Makefile 2 | *.built 3 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | build 2 | **/*.built 3 | steambox_ati/AMD-Catalyst-15.9-Linux-installer-15.201.1151-x86.x86_64.run 4 | -------------------------------------------------------------------------------- /util/rmdi: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # Remove dangling docker images 4 | ${DOCKER:-docker} images -qf dangling=true | xargs -r ${DOCKER:-docker} rmi 5 | -------------------------------------------------------------------------------- /util/rmec: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # Remove docker containers in the "exited" status" 4 | ${DOCKER:-docker} ps -aqf status=exited | xargs -r ${DOCKER:-docker} rm 5 | -------------------------------------------------------------------------------- /steambox/show_motd: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | if [ -r /etc/motd ] ; then 4 | cat /etc/motd 5 | fi 6 | 7 | cat << EOF 8 | 9 | ** Run "steam" if you want to run the steam client. 10 | ** You are a sudoer. Default password is "steamuser". 11 | EOF 12 | 13 | exec "${@}" 14 | -------------------------------------------------------------------------------- /steambox_ati/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM steambox_ati:postinstall 2 | MAINTAINER rsharo "rsharo@users.noreply.github.com" 3 | 4 | USER steamuser 5 | WORKDIR /home/steamuser 6 | ENV HOME /home/steamuser 7 | ENTRYPOINT [ "/usr/local/bin/show_motd" ] 8 | CMD ["/bin/bash"] 9 | 10 | -------------------------------------------------------------------------------- /steambox_nvidia/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM steambox 2 | MAINTAINER Jereme Corrado "jereme@zoion.net" 3 | 4 | USER root 5 | 6 | RUN apt-get install -y debian-archive-keyring 7 | RUN echo "deb http://ftp.debian.org/debian/ jessie-backports main contrib non-free" > /etc/apt/sources.list.d/jessie-backports.list 8 | RUN apt-get update && DEBIAN_FRONTEND=noninteractive \ 9 | apt-get install -y -t jessie-backports nvidia-driver 10 | 11 | USER steamuser 12 | -------------------------------------------------------------------------------- /steambox_nvidia/Makefile: -------------------------------------------------------------------------------- 1 | include ../functs.mk 2 | 3 | DOCKER ?= docker 4 | IMAGE= steambox_nvidia 5 | BUILTFILE = $(IMAGE:%=%.built) 6 | 7 | all: build 8 | 9 | build: $(IMAGE) 10 | 11 | distclean: clean 12 | $(call clean-image,$(IMAGE)) 13 | $(RM) $(BUILTFILE) 14 | 15 | clean: 16 | $(call clean-container,$(IMAGE)) 17 | 18 | $(IMAGE): % : %.built 19 | 20 | $(BUILTFILE): Dockerfile Makefile 21 | $(DOCKER) build -t $(@:%.built=%) . 22 | $(DOCKER) inspect $(@:%.built=%) > $(@) 23 | 24 | .PHONY: all build clean distclean $(IMAGE) 25 | -------------------------------------------------------------------------------- /steamos_buildmach/Makefile: -------------------------------------------------------------------------------- 1 | include ../functs.mk 2 | 3 | DOCKER ?= docker 4 | IMAGE= steamos_buildmach 5 | BUILTFILE = $(IMAGE:%=%.built) 6 | 7 | all: build 8 | 9 | build: $(IMAGE) 10 | 11 | distclean: clean 12 | $(call clean-image,$(IMAGE)) 13 | $(RM) $(BUILTFILE) 14 | 15 | clean: 16 | $(call clean-container,$(IMAGE)) 17 | 18 | $(IMAGE): % : %.built 19 | 20 | $(BUILTFILE): Dockerfile Makefile 21 | $(DOCKER) build -t $(@:%.built=%) . 22 | $(DOCKER) inspect $(@:%.built=%) > $(@) 23 | 24 | .PHONY: all build clean distclean $(IMAGE) 25 | -------------------------------------------------------------------------------- /steambox_ati/Dockerfile.1: -------------------------------------------------------------------------------- 1 | FROM steambox:latest 2 | MAINTAINER rsharo "rsharo@users.noreply.github.com" 3 | 4 | USER root 5 | WORKDIR /tmp 6 | 7 | RUN DEBIAN_FRONTEND=noninteractive apt-get -y install xserver-xorg pciutils 8 | 9 | ARG DRIVERFILE 10 | ADD ${DRIVERFILE} /tmp/${DRIVERFILE} 11 | 12 | # The following requires X11 to be active, so you have to do it from a "docker run" invocation 13 | #RUN /tmp/${DRIVERFILE} --install --force && rm /tmp/${DRIVERFILE} 14 | 15 | ENTRYPOINT [ "/bin/bash" ] 16 | CMD [ "-c", "./${DRIVERFILE} --install --force && rm /tmp/${DRIVERFILE}" ] 17 | 18 | -------------------------------------------------------------------------------- /steambox/bootstrap_steamdeps.txt: -------------------------------------------------------------------------------- 1 | # This is a package dependency manifest used by steamdeps 2 | 3 | # This should be set to the version of the Steam runtime that this program 4 | # is built with. 5 | # 6 | # Available values are: 7 | # 1 - Ubuntu 12.04 LTS 8 | # 9 | STEAM_RUNTIME=1 10 | 11 | # This should be set to the version of the dependency file format 12 | # 13 | # The file can contain lines starting with #, blank lines and dependencies 14 | # A dependency line consists of a package name for the current runtime, 15 | # along with optional architecture or version requirements using the 16 | # Debian package syntax: 17 | # http://www.debian.org/doc/debian-policy/ch-relationships.html 18 | # 19 | STEAM_DEPENDENCY_VERSION=1 20 | 21 | # These are non-arch specific dependencies 22 | curl 23 | python-apt 24 | xterm | gnome-terminal 25 | xz-utils 26 | zenity 27 | 28 | # These are i386 dependencies for Steam itself 29 | libgl1-mesa-dri:i386 30 | libgl1-mesa-glx:i386 31 | libc6:i386 32 | -------------------------------------------------------------------------------- /steambox_ati/Makefile: -------------------------------------------------------------------------------- 1 | include ../functs.mk 2 | 3 | DOCKER ?= docker 4 | IMAGE= steambox_ati 5 | BUILTFILE = $(IMAGE:%=%.built) 6 | DRIVERFILE ?= AMD-Catalyst-15.9-Linux-installer-15.201.1151-x86.x86_64.run 7 | 8 | all: build 9 | 10 | build: $(IMAGE) 11 | 12 | distclean: clean 13 | $(call clean-image,$(IMAGE)) 14 | $(RM) $(BUILTFILE) 15 | 16 | clean: 17 | $(call clean-container,$(IMAGE)) 18 | 19 | $(IMAGE): % : %.built 20 | 21 | pre-driver-install: Dockerfile.1 Makefile $(DRIVERFILE) 22 | $(DOCKER) build -t steambox_ati:preinstall --build-arg DRIVERFILE=$(DRIVERFILE) -f Dockerfile.1 . 23 | 24 | $(BUILTFILE): Dockerfile Makefile pre-driver-install 25 | $(DOCKER) run -ti --name steambox_ati \ 26 | -v /tmp/.X11-unix:/tmp/.X11-unix \ 27 | --env DRIVERFILE=$(DRIVERFILE) \ 28 | steambox_ati:preinstall 29 | $(DOCKER) commit steambox_ati steambox_ati:postinstall 30 | $(DOCKER) rm steambox_ati 31 | $(DOCKER) build -t $(@:%.built=%) . 32 | $(DOCKER) inspect $(@:%.built=%) > $(@) 33 | 34 | $(DRIVERFILE): 35 | $(error You do not appear to have $(DRIVERFILE): please download it from AMD/ATI's website before continuing.) 36 | 37 | .PHONY: all build clean distclean pre-driver-install $(IMAGE) 38 | 39 | -------------------------------------------------------------------------------- /steambox/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM brewmaster:latest 2 | MAINTAINER rsharo "rsharo@users.noreply.github.com" 3 | RUN apt-get update 4 | RUN apt-get -y dist-upgrade 5 | RUN apt-get -y install steam-launcher 6 | RUN apt-get -y install sudo vim less 7 | RUN apt-get -y install iceweasel 8 | RUN apt-get -y install pulseaudio libsdl2-2.0-0 firmware-linux-nonfree mesa-utils 9 | RUN apt-get -y install dbus-x11 10 | RUN apt-get -y install linux-headers-amd64 build-essential devscripts dkms 11 | # You may need the following if linux-headers-amd64 didn't pick up the right one(s) 12 | RUN apt-get -y install linux-headers-3.16.0-4-all 13 | 14 | ARG BOOTSTRAP_STEAMDEPS=bootstrap_steamdeps.txt 15 | ADD "${BOOTSTRAP_STEAMDEPS}" /root/steambox/bootstrap_steamdeps.txt 16 | RUN yes | /usr/bin/steamdeps /root/steambox/bootstrap_steamdeps.txt 17 | 18 | ARG STEAMUSER_UID 19 | ARG STEAMUSER_GID 20 | RUN groupadd --gid "${STEAMUSER_GID}" steamuser 21 | RUN useradd steamuser --uid "${STEAMUSER_UID}" --gid "${STEAMUSER_GID}" --groups sudo,audio,video --shell /bin/bash --home /home/steamuser 22 | RUN echo "steamuser:steamuser" | chpasswd 23 | 24 | ADD show_motd /usr/local/bin/show_motd 25 | RUN chmod 555 /usr/local/bin/show_motd 26 | 27 | USER steamuser 28 | WORKDIR /home/steamuser 29 | ENV HOME /home/steamuser 30 | ENTRYPOINT [ "/usr/local/bin/show_motd" ] 31 | CMD ["/bin/bash"] 32 | -------------------------------------------------------------------------------- /steambox/Makefile: -------------------------------------------------------------------------------- 1 | include ../functs.mk 2 | 3 | BOOTSTRAP_STEAMDEPS ?= ./bootstrap_steamdeps.txt 4 | 5 | ifeq ("","$(STEAMUSER_UID)") 6 | $(error you must provide STEAMUSER_UID (the UID of the host account that will be running steamos) to proceed) 7 | else 8 | $(info STEAMUSER_UID=$(STEAMUSER_UID)) 9 | endif 10 | 11 | ifeq ("","$(STEAMUSER_GID)") 12 | $(error you must provide STEAMUSER_GID (the GID of the host account that will be running steamos) to proceed) 13 | else 14 | $(info STEAMUSER_GID=$(STEAMUSER_GID)) 15 | endif 16 | 17 | ifeq ("","$(STEAMUSER_HOME)") 18 | $(error you must provide STEAMUSER_HOME (home directory of the host account that will be running steamos) to proceed) 19 | else 20 | $(info STEAMUSER_HOME=$(STEAMUSER_HOME)) 21 | endif 22 | 23 | DOCKER ?= docker 24 | IMAGE= steambox 25 | BUILTFILE = $(IMAGE:%=%.built) 26 | 27 | all: build 28 | 29 | build: $(IMAGE) 30 | 31 | distclean: clean 32 | $(call clean-image,$(IMAGE)) 33 | $(RM) $(BUILTFILE) 34 | 35 | clean: 36 | $(call clean-container,$(IMAGE)) 37 | 38 | $(IMAGE): % : %.built 39 | 40 | $(BUILTFILE): Dockerfile show_motd $(BOOTSTRAP_STEAMDEPS) Makefile 41 | $(DOCKER) build -t $(@:%.built=%) \ 42 | --build-arg "STEAMUSER_UID=$(STEAMUSER_UID)" \ 43 | --build-arg "STEAMUSER_GID=$(STEAMUSER_GID)" \ 44 | --build-arg "BOOTSTRAP_STEAMDEPS=$(BOOTSTRAP_STEAMDEPS)" \ 45 | . 46 | $(DOCKER) inspect $(@:%.built=%) > $(@) 47 | 48 | .PHONY: all build clean distclean $(IMAGE) 49 | 50 | -------------------------------------------------------------------------------- /Makefile: -------------------------------------------------------------------------------- 1 | include functs.mk 2 | 3 | # Build parameters 4 | export DOCKER ?= docker 5 | export SUITE ?= brewmaster 6 | export VARIANT ?= minbase 7 | export STEAMREPO ?= http://repo.steampowered.com/steamos 8 | export BASEIMAGE ?= $(SUITE) 9 | export STEAMUSER_UID STEAMUSER_GID STEAMUSER_HOME 10 | 11 | IMAGES= steambox_ati steambox_nvidia steambox steamos_buildmach 12 | BUILDDIR=./build 13 | 14 | all: steambox 15 | 16 | steambox_ati: steambox 17 | 18 | steambox_nvidia: steambox 19 | 20 | steambox: baseimage 21 | 22 | baseimage: $(BUILDDIR)/$(BASEIMAGE).built 23 | 24 | $(IMAGES): 25 | $(MAKE) -C $(@) build 26 | 27 | distclean: clean 28 | $(foreach img,$(IMAGES),$(MAKE) -C $(img) $(@);) 29 | $(RM) -r $(BUILDDIR) 30 | 31 | 32 | clean: 33 | $(foreach img,$(IMAGES),$(MAKE) -C $(img) $(@);) 34 | 35 | 36 | $(BUILDDIR)/$(BASEIMAGE).built: $(BUILDDIR) 37 | @if ( $(call check-new-image,$(BASEIMAGE)) ) ; then \ 38 | echo "Building baseimage $(BASEIMAGE)..." ; \ 39 | $(MAKE) build-baseimage ; \ 40 | fi 41 | $(DOCKER) inspect $(BASEIMAGE) > $(BUILDDIR)/$(BASEIMAGE).built 42 | 43 | 44 | debug-buildmach: steamos_buildmach 45 | $(DOCKER) run -ti --privileged --rm \ 46 | -v "$(abspath $(BUILDDIR)):/root/steamos" \ 47 | --entrypoint /bin/bash \ 48 | steamos_buildmach -i 49 | 50 | 51 | delete-baseimage: 52 | @$(call check-confirm,Are you sure you want to delete your SteamOS base image ($(BASEIMAGE))?) 53 | @echo 54 | $(call clean-container,$(BASEIMAGE)) 55 | $(call clean-image,$(BASEIMAGE)) 56 | $(RM) $(BUILDDIR)/$(BASEIMAGE).built 57 | 58 | 59 | build-baseimage: $(BUILDDIR)/Dockerfile $(BUILDDIR)/rootfs.tar.xz 60 | $(DOCKER) build -t $(BASEIMAGE) ./build 61 | 62 | 63 | $(BUILDDIR)/Dockerfile $(BUILDDIR)/rootfs.tar.xz: steamos_buildmach $(BUILDDIR) 64 | @$(call check-new-container-msg,steamos_buildmach, \ 65 | steamos_buildmach already exists. Please run \"make clean\" first.) 66 | $(DOCKER) run -ti --privileged --rm \ 67 | --name steamos_buildmach \ 68 | -v "$(abspath $(BUILDDIR)):/root/steamos" steamos_buildmach \ 69 | "--variant=$(VARIANT)" "$(SUITE)" "$(STEAMREPO)" 70 | 71 | $(BUILDDIR): 72 | mkdir -p $(BUILDDIR) 73 | 74 | .PHONY: all clean distclean baseimage build-baseimage delete-baseimage debug-buildmach $(IMAGES) 75 | 76 | -------------------------------------------------------------------------------- /functs.mk: -------------------------------------------------------------------------------- 1 | # Author: rsharo 2 | 3 | # 4 | # Call a single-argument function on every element in a list 5 | # usage: 6 | # $(call myFunction,file1 file2 ... fileN) 7 | map1arg = $(foreach a,$(2),$(call $(1),$(a))) 8 | 9 | 10 | # 11 | # Remove containers from docker daemon 12 | # usage: 13 | # $(call clean-container,myContainerName) 14 | clean-container = $(DOCKER) ps -aq -f "name=$(1)" | xargs -r $(DOCKER) rm -f 15 | 16 | 17 | # 18 | # Remove images from docker daemon 19 | # usage: 20 | # $(call clean-image, myImageName) 21 | clean-image = $(DOCKER) images -q "$(1)" | xargs -r $(DOCKER) rmi -f 22 | 23 | 24 | # 25 | # Remove volumes from docker daemon 26 | # usage: 27 | # $(call clean-volume, myVolumeName) 28 | clean-volume = $(DOCKER) volume ls -qf "name=$(1)" | xargs -r $(DOCKER) volume rm 29 | 30 | 31 | # 32 | # Prompt user, retain fail code if user doesn't press "y" 33 | # usage: 34 | # @$(call check-confirm,"Are you sure you want to do that?") 35 | # @echo 36 | check-confirm = bash -c 'read -n 1 -t 20 -p "$(1) [y/N] " response ; [[ "$$response" == "y" ]]' 37 | 38 | 39 | # 40 | # Return fail code if container already exists 41 | # usage: 42 | # @$(call check-new-container,containerName) 43 | # $(DOCKER) run --name containerName ... 44 | check-new-container = $(DOCKER) ps -aq -f "name=$(1)" | xargs -r false 45 | 46 | 47 | # 48 | # Return fail code if local image repository exists 49 | # usage: 50 | # @if ( $(call check-new-image,$(IMAGE)) ) ; then \ 51 | # echo "Building $(IMAGE)..." ; \ 52 | # $(DOCKER) build -t $(IMAGE) $(IMAGE) ; \ 53 | # fi 54 | check-new-image = $(DOCKER) images -q "$(1)" | xargs -r false 55 | 56 | 57 | # 58 | # Variants that accept a list of arguments 59 | # usage: 60 | # $(call XXXs,arg1 arg2 ... argN) 61 | clean-containers = $(call map1arg,clean-container,$(1)) 62 | clean-images = $(call map1arg,clean-image,$(1)) 63 | clean-volumes = $(call map1arg,clean-volume,$(1)) 64 | check-new-images = $(call check-new-image,$(1)) 65 | check-new-containers = $(call check-new-container,$(1)) 66 | 67 | 68 | # 69 | # Variants that print an error message on failure 70 | # usage: 71 | # @$(call XXX-msg,arg,"ERROR: command failed.") 72 | # $(DOCKER) build ... 73 | call-with-msg = ( $(call $(1),$(2)) ) || ( echo $(3)>&2 ; false ) 74 | check-new-container-msg = $(call call-with-msg,check-new-container,$(1),$(2)) 75 | check-new-containers-msg = $(call call-with-msg,check-new-containers,$(1),$(2)) 76 | check-new-image-msg = $(call call-with-msg,check-new-image,$(1),$(2)) 77 | check-new-images-msg = $(call call-with-msg,check-new-images,$(1),$(2)) 78 | -------------------------------------------------------------------------------- /util/steambox: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # Launches the steambox image with direct connections to the specified 4 | # user's X session, ALSA, and PulseAudio. 5 | # 6 | # Author: rsharo 7 | 8 | ### functions 9 | 10 | function disclaimer() { 11 | cat << EOF 12 | $0: WARNING: This script launches a steambox Docker container with 13 | unrestricted access to your X session, audio drivers, and dbus. 14 | 15 | There are no provisions stopping the container from: 16 | 1) Showing you spoofed windows, including prompts to enter your password. 17 | 2) Accessing your microphone 18 | 3) Capturing mouse gestures and/or keystrokes 19 | 4) Sending commands to other desktop applications via dbus 20 | 5) Reading (but not changing) your machine-id 21 | 6) Accessing shared memory 22 | 7) Playing polka music or even worse... Justin Bieber. 23 | 24 | EOF 25 | 26 | read -n 1 -t 20 -p "Are you sure you want to continue? [N/y] " response 27 | echo 28 | if [[ "${response}" != "y" ]]; then 29 | echo "Exiting." >&2 30 | exit 1 31 | fi 32 | } 33 | 34 | 35 | ### Main script 36 | 37 | disclaimer $0 38 | 39 | STEAMBOX=${STEAMBOX:-"steambox"} 40 | STEAMUSER_DISPLAY=${STEAMUSER_DISPLAY:-":0"} 41 | 42 | echo STEAMUSER_UID=${STEAMUSER_UID:?"$0: you must set the environment variable STEAMUSER_UID"} 43 | echo STEAMUSER_HOME=${STEAMUSER_HOME:?"$0: you must set the environment variable STEAMUSER_HOME"} 44 | echo STEAMUSER_DISPLAY=${STEAMUSER_DISPLAY} 45 | 46 | STEAMHOME="${STEAMUSER_HOME}/steamhome" 47 | 48 | declare -a HOMEDIR_ARGS=( -v "${STEAMHOME}:/home/steamuser" ) 49 | 50 | declare -a DRIDEVS=() 51 | if [[ -d /dev/dri ]] ; then 52 | DRIDEVS+=(/dev/dri/*) 53 | fi 54 | if [[ -d /dev/ati ]] ; then 55 | DRIDEVS+=(/dev/ati/*) 56 | fi 57 | for cdev in nvidiactl nvidia-modeset; do 58 | if [[ -c /dev/${cdev} ]] ; then 59 | DRIDEVS+=(/dev/${cdev}) 60 | fi 61 | done 62 | for i in $(seq 0 9); do 63 | cdev="nvidia${i}" 64 | if [[ -c /dev/${cdev} ]] ; then 65 | DRIDEVS+=(/dev/${cdev}) 66 | fi 67 | done 68 | 69 | declare -a X11_ARGS=( 70 | -v /tmp/.X11-unix:/tmp/.X11-unix 71 | ${DRIDEVS[@]/#/--device } 72 | --env "DISPLAY=${STEAMUSER_DISPLAY}" 73 | ) 74 | 75 | declare -a ALSA_ARGS=($(find /dev/snd -type c -printf "--device %p ")) 76 | 77 | declare -a PULSE_ARGS=( 78 | -v /dev/shm:/dev/shm 79 | -v /etc/machine-id:/etc/machine-id:ro 80 | -v "/run/user/${STEAMUSER_UID}/pulse:/run/user/${STEAMUSER_UID}/pulse" 81 | -v /var/lib/dbus:/var/lib/dbus 82 | -v "${STEAMUSER_HOME}/.pulse:/home/steamuser/.pulse" 83 | ) 84 | 85 | echo $0: Using args: "${HOMEDIR_ARGS[@]}" "${X11_ARGS[@]}" "${ALSA_ARGS[@]}" "${PULSE_ARGS[@]}" 86 | 87 | if [[ ! -d "${STEAMHOME}" ]] ; then 88 | echo "$0: The steam home directory '${STEAMHOME}' does not exist or is not a directory. Please create it with the appropriate user permissions." 2>&1 89 | exit 1 90 | fi 91 | 92 | 93 | ${DOCKER:-docker} run -ti --rm --name "${STEAMBOX}" \ 94 | "${HOMEDIR_ARGS[@]}" "${X11_ARGS[@]}" "${ALSA_ARGS[@]}" "${PULSE_ARGS[@]}" \ 95 | "${STEAMBOX}" "$@" 96 | 97 | -------------------------------------------------------------------------------- /steamos_buildmach/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM debian:jessie 2 | 3 | MAINTAINER rsharo "rsharo@users.noreply.github.com" 4 | 5 | RUN apt-get update 6 | 7 | # Tools required for secure repo access 8 | RUN apt-get -y install apt-transport-https ca-certificates gnupg2 9 | 10 | 11 | # Docker key and repo 12 | # pub 4096R/2C52609D 2015-07-14 13 | # Key fingerprint = 5811 8E89 F3A9 1289 7C07 0ADB F762 2157 2C52 609D 14 | # uid Docker Release Tool (releasedocker) 15 | # **IMPORTANT** If this script fails on the "--fingerprint" line , you may have a falsified key! 16 | RUN apt-key adv --keyserver hkp://ha.pool.sks-keyservers.net:80 --recv-keys 58118E89F3A912897C070ADBF76221572C52609D 17 | RUN apt-key adv --fingerprint 2c52609d | grep "Key fingerprint = 5811 8E89 F3A9 1289 7C07 0ADB F762 2157 2C52 609D" 18 | RUN echo 'deb https://apt.dockerproject.org/repo debian-jessie main' > /etc/apt/sources.list.d/docker.list 19 | 20 | 21 | # Steam (Valve) key and repo 22 | # pub 2048R/8ABDDD96 2013-11-05 23 | # Key fingerprint = 48FD 4330 8E37 C3A4 18B9 2A15 7DEE B743 8ABD DD96 24 | # uid Valve SteamOS Release Key 25 | # sub 2048R/103C02AE 2013-11-05 26 | # **IMPORTANT** If this script fails on the "--fingerprint" line , you may have a falsified key! 27 | RUN apt-key adv --keyserver hkp://ha.pool.sks-keyservers.net:80 --recv-keys 7DEEB7438ABDDD96 28 | RUN apt-key adv --fingerprint 8abddd96 | grep "Key fingerprint = 48FD 4330 8E37 C3A4 18B9 2A15 7DEE B743 8ABD DD96" 29 | RUN echo 'deb http://repo.steampowered.com/steamos alchemist main contrib non-free' > /etc/apt/sources.list.d/alchemist.list 30 | RUN echo 'deb http://repo.steampowered.com/steamos brewmaster main contrib non-free' > /etc/apt/sources.list.d/brewmaster.list 31 | 32 | 33 | # Tools for building docker images 34 | RUN apt-get update 35 | RUN apt-get -y install debootstrap binutils 36 | RUN apt-get -y install docker-engine 37 | 38 | # Retrieve valve-archive-keyring.gpg 39 | RUN apt-get -y install valve-archive-keyring 40 | 41 | # We are running in a container -- tweak mkimage.sh so it skips "docker build" 42 | WORKDIR /usr/share/docker-engine/contrib 43 | RUN sed -e 's/docker build/echo SKIPPING docker build/' mkimage.sh > mkimage_rootfsonly.sh 44 | RUN chmod 555 mkimage_rootfsonly.sh 45 | 46 | # SteamOS clobbers the Debian keyring with their own (Valve) keyring. 47 | # Our build machine is true Debian: tell debootstrap to use valve-archive-keyring.gpg 48 | WORKDIR /usr/share/debootstrap/scripts/ 49 | RUN if [ -e alchemist ] ; then \ 50 | sed -i.orig -e 's/debian-archive-keyring.gpg/valve-archive-keyring.gpg/' alchemist ; \ 51 | else \ 52 | sed -e 's/debian-archive-keyring.gpg/valve-archive-keyring.gpg/' wheezy > alchemist ; \ 53 | fi 54 | RUN if [ -e brewmaster ] ; then \ 55 | sed -i.orig -e 's/debian-archive-keyring.gpg/valve-archive-keyring.gpg/' brewmaster ; \ 56 | else \ 57 | sed -e 's/debian-archive-keyring.gpg/valve-archive-keyring.gpg/' jessie > brewmaster ; \ 58 | fi 59 | RUN ln -s alchemist alchemist_beta 60 | RUN ln -s brewmaster brewmaster_beta 61 | 62 | # Makefile mounts the following path. Uncomment this line if not using the makefile. 63 | #VOLUME [ "/root/steamos" ] 64 | 65 | WORKDIR /root 66 | SHELL [ "/bin/bash" , "-c" ] 67 | ENTRYPOINT [ "/usr/share/docker-engine/contrib/mkimage_rootfsonly.sh", "-d", "steamos", "debootstrap" ] 68 | 69 | # resulting Dockerfile and tarball will be found in /root/steamos 70 | CMD [ "--variant=minbase", "brewmaster", "http://repo.steampowered.com/steamos" ] 71 | 72 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # steamos_docker 2 | Builds a [SteamOS](http://store.steampowered.com/steamos/) [docker](https://www.docker.com/) image directly from Valve repositories. *(for the paranoid.)* 3 | 4 | > **[TL;DR] Requires Docker 1.13 or later.** From an account with Docker privileges (e.g. root), run the following: 5 | > ``` 6 | XUSER= 7 | export STEAMUSER_UID=$(id -u ${XUSER}) 8 | export STEAMUSER_GID=$(id -g ${XUSER}) 9 | export STEAMUSER_HOME=$(grep "${XUSER}" /etc/passwd | cut -f6 -d:) 10 | mkdir ${STEAMUSER_HOME}/steamhome && chown ${XUSER}:${XUSER} ${XUSER}/steamhome 11 | make 12 | util/steambox 13 | ``` 14 | > 15 | >You'll build and launch a docker image named `steambox`. Type `steam` to run the steam launcher. 16 | > 17 | >*Note: still working to streamline this process* 18 | 19 | 20 | Currently configured to build SteamOS `brewmaster`. Other suites are untested. 21 | 22 | 23 | All binaries are pulled from http://repo.steampowered.com/steamos using gpg keys from `hkp://ha.pool.sks-keyservers.net:80`. 24 | 25 | 26 | The filesystem build runs as root inside a bootstrap container [FROM](https://docs.docker.com/engine/reference/builder/#/from) the official `debian:jessie` base image. Once the SteamOS file tree is built, it is pulled from the container and installed onto the Docker host with `docker build`. 27 | 28 | Run "make" (as root) to: 29 | 1. Create a build machine based on `debian:jessie`, called `steamos_buildmach` 30 | 2. Load all dependencies needed to bootstrap a SteamOS image 31 | 3. Run a `steamos_buildmach` container, producing a SteamOS root file system 32 | 4. Build a `$(SUITE)` SteamOS *(minbase)* base image, where `$(SUITE)` defaults to `brewmaster` 33 | 4. Build `steambox` image that can actually run the steam launcher 34 | 35 | 36 | ## Makefile Targets 37 | 38 | Target | Description 39 | -------|-------- 40 | all | Equivalent to `steambox` 41 | steambox | Builds the `steambox` image and all dependencies 42 | baseimage | Builds the SteamOS minbase Docker base image 43 | build-baseimage | Forcibly rebuilds `baseimage` even if you already have one 44 | delete-baseimage | Deletes all `baseimage` containers and local repository images. *NOTE: asks for confirmation* 45 | steamos_buildmach | Builds `steamos_buildmach`: a Debian image that can build SteamOS base images 46 | debug-buildmach | Runs `steamos_buildmach` with bash tty. 47 | clean | Equivalent to `docker rm -f steamos_buildmach steambox`. 48 | distclean | Removes `steambox`, `buildmach`, and build artifacts. Retains the baseimage. 49 | steambox_ati | Builds `steambox_ati`: a derivative of `steambox` with support for ATI video cards. 50 | steambox_nvidia | Builds `steambox_nvidia`: a derivative of `steambox` with support for NVIDIA video cards. 51 | 52 | 53 | ## Makefile Build Parameters 54 | 55 | Parameter | Default | Description 56 | ----------|---------|------------- 57 | STEAMUSER_UID | *none* | The user id of the *host* user running Steam. Required for the `steambox` target only. 58 | STEAMUSER_GID | *none* | The group id of the *host* user running Steam. Required for the `steambox` target only. 59 | STEAMUSER_HOME | *none* | The home directory of the *host* user running Steam. Required for the `steambox` target only. 60 | BASEIMAGE | `$(SUITE)` | Docker repository name for the final SteamOS base image 61 | SUITE | brewmaster | SteamOS version to build 62 | VARIANT | minbase | [debootstrap](https://wiki.debian.org/Debootstrap) variant of SteamOS to build 63 | STEAMREPO | http://repo.steampowered.com/steamos | Where to get the SteamOS binaries 64 | DOCKER | docker | The program used to control the docker daemon 65 | DRIVERFILE | AMD-Catalyst-15.9-Linux-installer-15.201.1151-x86.x86_64.run | **ATI build only** The video driver installer (you must download it into `steambox_ati`) 66 | 67 | 68 | ## Running The Driver-Specific Builds 69 | ``` 70 | STEAMBOX=steambox_nvidia ./util/steambox 71 | ``` 72 | --------------------------------------------------------------------------------