shithub: choc

Download patch

ref: c5209ccbb0b1cdaff26f3b0a3903b68bd229d869
parent: 41865b179684eaf812fc9682936d9b79320f5a1d
author: Filip Sufitchi <fsufitchi@gmail.com>
date: Tue Feb 8 17:54:30 EST 2022

Working devcontainer for building and running choco in Docker on Linux

diff: cannot open b/.devcontainer//null: file does not exist: 'b/.devcontainer//null'
--- /dev/null
+++ b/.devcontainer/.gitignore
@@ -1,0 +1,2 @@
+*.xauth
+wads/
\ No newline at end of file
--- /dev/null
+++ b/.devcontainer/Dockerfile
@@ -1,0 +1,34 @@
+FROM ubuntu
+
+######### Apt dependencies
+
+ARG system_apt_dependencies="build-essential automake autoconf libtool git pkg-config python3 python3-pip sudo"
+ARG choco_apt_dependencies="gcc make libsdl2-dev libsdl2-net-dev libsdl2-mixer-dev"
+RUN apt-get update && \
+    DEBIAN_FRONTEND=noninteractive apt-get install -qq $system_apt_dependencies $choco_apt_dependencies
+
+########## Install Pillow (PIL) via pip, not apt
+
+ARG choco_pip_dependencies="pillow"
+RUN pip install $choco_pip_dependencies
+
+########## Container user setup
+
+ARG USERNAME=chocodev
+ARG USER_UID=1000
+ARG USER_GID=$USER_UID
+RUN groupadd --gid $USER_GID $USERNAME \
+    && useradd --uid $USER_UID --gid $USER_GID -m $USERNAME
+
+# Add sudo support
+RUN echo $USERNAME ALL=\(root\) NOPASSWD:ALL > /etc/sudoers.d/$USERNAME \
+    && chmod 0440 /etc/sudoers.d/$USERNAME
+
+# Add the user to the audio group, to have ALSA sound access
+# TODO: pulseaudio, so this isn't necessary?
+RUN addgroup $USERNAME audio
+
+# Use bash, not sh. Yuck.
+RUN chsh $USERNAME -s /bin/bash
+
+USER $USERNAME
--- /dev/null
+++ b/.devcontainer/devcontainer.json
@@ -1,0 +1,39 @@
+// For format details, see https://aka.ms/devcontainer.json. For config options, see the README at:
+// https://github.com/microsoft/vscode-dev-containers/tree/v0.209.6/containers/docker-existing-dockerfile
+{
+	"name": "Existing Dockerfile",
+
+	// Sets the run context to one level up instead of the .devcontainer folder.
+	"context": "..",
+
+	// Update the 'dockerFile' property if you aren't using the standard 'Dockerfile' filename.
+	"dockerFile": "./Dockerfile",
+
+	// Set *default* container specific settings.json values on container create.
+	"settings": {},
+	
+	// Add the IDs of extensions you want installed when the container is created.
+	"extensions": [
+		"ms-vscode.cpptools-extension-pack",
+	],
+
+	// Required to not bleed "root" permission files into the volume
+	"containerUser": "chocodev",
+
+	// VSCode on Linux specific, for creating X11 and sound forwarding
+	// Comment out manually if working on non-Linux
+	"initializeCommand": "sh ${localWorkspaceFolder}/.devcontainer/xauth-configure.sh ${localWorkspaceFolder}/.devcontainer/devcontainer.xauth",
+	"mounts": [
+		"source=/tmp/.X11-unix,target=/tmp/.X11-unix,type=bind",
+	],
+	"containerEnv": {
+		"DISPLAY": "${localEnv:DISPLAY}",
+		"XAUTHORITY": "${containerWorkspaceFolder}/.devcontainer/devcontainer.xauth",
+	},
+	"runArgs": [
+		// "--gpus", "all",  // Uncomment for GPU support
+		"--device", "/dev/snd",  // TODO: pulseaudio? https://github.com/mviereck/x11docker/wiki/Container-sound:-ALSA-or-Pulseaudio
+	]
+
+	// TODO: X11/sound forwarding configs for MacOS (XQuartz) and Windows (Xming)
+}
--- /dev/null
+++ b/.devcontainer/xauth-configure.sh
@@ -1,0 +1,6 @@
+#!/bin/sh
+
+# Specify arg of path to create the xauth at
+
+touch $1;
+xauth nlist $DISPLAY | sed -e 's/^..../ffff/' | xauth -f $1 nmerge -
--- a/.gitignore
+++ b/.gitignore
@@ -57,3 +57,7 @@
 GRTAGS
 GTAGS
 /HTML/
+
+# VSCode settings
+
+/.vscode/
\ No newline at end of file