Browse Source

Set up default settings for a GitHub Codespace

pull/6564/head
Gleb Mazovetskiy 3 years ago
parent
commit
1156b46714
  1. 43
      .devcontainer/Dockerfile
  2. 30
      .devcontainer/devcontainer.json
  3. 7
      .devcontainer/fluxbox/apps
  4. 20
      .devcontainer/fluxbox/menu
  5. BIN
      docs/gh-codespaces-ports-browser.png
  6. 13
      docs/github-codespaces.md

43
.devcontainer/Dockerfile

@ -0,0 +1,43 @@
ARG VARIANT=debian-12
FROM mcr.microsoft.com/devcontainers/base:${VARIANT}
USER root
# Install APT packages
RUN apt-get update && export DEBIAN_FRONTEND=noninteractive \
&& apt-get -y install tar curl zip unzip bash-completion build-essential ripgrep htop \
ninja-build ccache g++ mold gdb clang-format clang-tidy \
rpm pkg-config cmake git smpq gettext libsdl2-dev libsdl2-image-dev libsodium-dev \
libpng-dev libbz2-dev libfmt-dev libgtest-dev libgmock-dev libsimpleini-dev zsh \
qtbase5-dev qt6-base-dev ristretto \
&& apt-get autoremove -y && apt-get clean -y && rm -rf /var/lib/apt/lists/*
# Install devilutionx-graphics-tools
RUN git clone https://github.com/diasurgical/devilutionx-graphics-tools.git /tmp/devilutionx-graphics-tools && \
cd /tmp/devilutionx-graphics-tools && \
cmake -S. -Bbuild-rel -G Ninja -DCMAKE_BUILD_TYPE=Release -DBUILD_SHARED_LIBS=OFF && \
cmake --build build-rel -j $(getconf _NPROCESSORS_ONLN) && \
cmake --install build-rel --component Binaries && \
rm -rf /tmp/devilutionx-graphics-tools
# Install devilutionx-mpq-tools
RUN git clone https://github.com/diasurgical/devilutionx-mpq-tools.git /tmp/devilutionx-mpq-tools && \
cd /tmp/devilutionx-mpq-tools && \
cmake -S. -Bbuild-rel -G Ninja -DCMAKE_BUILD_TYPE=Release -DBUILD_SHARED_LIBS=OFF && \
cmake --build build-rel -j $(getconf _NPROCESSORS_ONLN) && \
cmake --install build-rel && \
rm -rf /tmp/devilutionx-mpq-tools
# Install d1-graphics-tool
RUN curl -O -L https://github.com/diasurgical/d1-graphics-tool/releases/latest/download/D1GraphicsTool-Linux-x64.deb && \
dpkg -i D1GraphicsTool-Linux-x64.deb && \
rm D1GraphicsTool-Linux-x64.deb
# Download spawn.mpq and fonts.mpq
RUN curl --create-dirs -O -L --output-dir /usr/local/share/diasurgical/devilutionx/ \
https://github.com/diasurgical/devilutionx-assets/releases/latest/download/spawn.mpq && \
curl --create-dirs -O -L --output-dir /usr/local/share/diasurgical/devilutionx/ \
https://github.com/diasurgical/devilutionx-assets/releases/latest/download/fonts.mpq && \
chown -R vscode: /usr/local/share/diasurgical/
# Desktop environment configuration
COPY fluxbox /home/vscode/.fluxbox/

30
.devcontainer/devcontainer.json

@ -0,0 +1,30 @@
{
"build": {
"dockerfile": "Dockerfile"
},
"customizations": {
"vscode": {
"extensions": [
"github.vscode-github-actions",
"ms-vscode.cmake-tools"
]
}
},
"features": {
// https://github.com/devcontainers/features/tree/main/src/desktop-lite
"ghcr.io/devcontainers/features/desktop-lite:1": {
"webPort": 6080,
"password": "vscode"
},
"ghcr.io/devcontainers-contrib/features/zsh-plugins:0": {},
"ghcr.io/stuartleeks/dev-container-features/shell-history:0": {}
},
"forwardPorts": [
6080
],
"portsAttributes": {
"6080": {
"label": "desktop"
}
}
}

7
.devcontainer/fluxbox/apps

@ -0,0 +1,7 @@
[transient] (role=GtkFileChooserDialog)
[Dimensions] {70% 70%}
[Position] (CENTER) {0 0}
[end]
[app] (name=AppRun) (class=tiled)
[Fullscreen] {yes}
[end]

20
.devcontainer/fluxbox/menu

@ -0,0 +1,20 @@
[begin] ( Application Menu )
[exec] (File Manager) { nautilus /workspaces/devilutionX } </usr/share/icons/gnome/32x32/apps/file-manager.png>
[exec] (D1 Graphics Tool) { D1GraphicsTool } <>
[exec] (Text Editor) { mousepad } <>
[exec] (Terminal) { tilix -w ~ -e $(readlink -f /proc/$$/exe) -il } <>
[exec] (Web Browser) { x-www-browser --disable-dev-shm-usage } <>
[submenu] (System) {}
[exec] (Set Resolution) { tilix -t "Set Resolution" -e bash /usr/local/bin/set-resolution } <>
[exec] (Edit Application Menu) { mousepad ~/.fluxbox/menu } <>
[exec] (Passwords and Keys) { seahorse } <>
[exec] (Top Processes) { tilix -t "Top" -e htop } <>
[exec] (Disk Utilization) { tilix -t "Disk Utilization" -e ncdu / } <>
[exec] (Editres) {editres} <>
[exec] (Xfontsel) {xfontsel} <>
[exec] (Xkill) {xkill} <>
[exec] (Xrefresh) {xrefresh} <>
[end]
[config] (Configuration)
[workspaces] (Workspaces)
[end]

BIN
docs/gh-codespaces-ports-browser.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 20 KiB

13
docs/github-codespaces.md

@ -0,0 +1,13 @@
# Developing with GitHub Codespaces
A GitHub codespace container with all dependencies and several useful tools preinstalled is configured in the `.devcontainer` directory.
You can go to https://github.dev/diasurgical/devilutionX/ and immediately begin developing.
To view the graphical desktop of the container, click Ports > Browser.
The password is `vscode`.
![screenshot](gh-codespaces-ports-browser.png)
For more information about the deskopt envorinonment, see https://github.com/devcontainers/features/tree/main/src/desktop-lite
Loading…
Cancel
Save