From 4636f06ede9d8b9de16cf4968920e8611fc5fc74 Mon Sep 17 00:00:00 2001 From: deadmeu Date: Sat, 3 Aug 2024 16:53:10 +1000 Subject: [PATCH] chore: Update dev container configuration Updates the dev container configuration to use the default Microsoft supported rust environment. Support for GUI rendering is also included for Linux hosts using Wayland. --- .devcontainer/Dockerfile | 12 ------ .devcontainer/devcontainer.json | 64 +++++++++++++++++++----------- .devcontainer/postCreateCommand.sh | 14 +++++++ .github/dependabot.yml | 12 ++++++ 4 files changed, 67 insertions(+), 35 deletions(-) delete mode 100644 .devcontainer/Dockerfile create mode 100755 .devcontainer/postCreateCommand.sh create mode 100644 .github/dependabot.yml diff --git a/.devcontainer/Dockerfile b/.devcontainer/Dockerfile deleted file mode 100644 index 63d7bcd3a..000000000 --- a/.devcontainer/Dockerfile +++ /dev/null @@ -1,12 +0,0 @@ -# See here for image contents: https://github.com/microsoft/vscode-dev-containers/tree/master/containers/ubuntu/.devcontainer/base.Dockerfile -# [Choice] Ubuntu version (use jammy or bionic on local arm64/Apple Silicon): jammy, focal, bionic -ARG VARIANT="jammy" -FROM mcr.microsoft.com/vscode/devcontainers/base:0-${VARIANT} - -# Derived from Tauri contribution and setup guides: -# See: https://github.com/tauri-apps/tauri/blob/dev/.github/CONTRIBUTING.md#development-guide -# See: https://tauri.app/v1/guides/getting-started/prerequisites/#setting-up-linux -ARG TAURI_BUILD_DEPS="build-essential curl libappindicator3-dev libgtk-3-dev librsvg2-dev libssl-dev libwebkit2gtk-4.1-dev wget" - -RUN apt-get update && export DEBIAN_FRONTEND=noninteractive \ - && apt-get install -y --no-install-recommends $TAURI_BUILD_DEPS diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json index a7a9805c3..1a1f1fe02 100644 --- a/.devcontainer/devcontainer.json +++ b/.devcontainer/devcontainer.json @@ -1,30 +1,48 @@ -// 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.234.0/containers/ubuntu +// For format details, see https://aka.ms/devcontainer.json. For config options, see the +// README at: https://github.com/devcontainers/templates/tree/main/src/rust { - "name": "Ubuntu", - "build": { - "dockerfile": "Dockerfile", - // Update 'VARIANT' to pick an Ubuntu version: jammy / ubuntu-22.04, focal / ubuntu-20.04, bionic /ubuntu-18.04 - // Use ubuntu-22.04 or ubuntu-18.04 on local arm64/Apple Silicon. - "args": { "VARIANT": "ubuntu-22.04" } - }, + "name": "Tauri", + // Or use a Dockerfile or Docker Compose file. More info: https://containers.dev/guide/dockerfile + "image": "mcr.microsoft.com/devcontainers/rust:1-1-bookworm", - // Set *default* container specific settings.json values on container create. - "settings": {}, + "remoteEnv": { + "XDG_RUNTIME_DIR": "/tmp", + "WAYLAND_DISPLAY": "${localEnv:WAYLAND_DISPLAY}" + }, - // Add the IDs of extensions you want installed when the container is created. - "extensions": [], + // Use 'mounts' to make the cargo cache persistent in a Docker Volume. + "mounts": [ + // Wayland + // TODO: ${containerEnv:} substitution currently broken (https://github.com/microsoft/vscode-remote-release/issues/10033) + // "source=/${localEnv:XDG_RUNTIME_DIR}/${localEnv:WAYLAND_DISPLAY},target=/${containerEnv:XDG_RUNTIME_DIR}/${containerEnv:WAYLAND_DISPLAY},readonly,type=bind", + "source=${localEnv:XDG_RUNTIME_DIR}/${localEnv:WAYLAND_DISPLAY},target=/tmp/${localEnv:WAYLAND_DISPLAY},readonly,type=bind" - // Use 'forwardPorts' to make a list of ports inside the container available locally. - // "forwardPorts": [], + // X11 + // TODO: does not work + // "source=/tmp/.X11-unix,target=/tmp/.X11-unix,readonly,type=bind" + ], - // Use 'postCreateCommand' to run commands after the container is created. - // "postCreateCommand": "uname -a", + // Features to add to the dev container. More info: https://containers.dev/features. + // "features": {}, - // Comment out to connect as root instead. More info: https://aka.ms/vscode-remote/containers/non-root. - "remoteUser": "vscode", - "features": { - "node": "lts", - "rust": "latest" - } + // Use 'forwardPorts' to make a list of ports inside the container available locally. + // "forwardPorts": [], + + "runArgs": [ + "--userns=keep-id" + ], + + // Use 'postCreateCommand' to run commands after the container is created. + "postCreateCommand": "./.devcontainer/postCreateCommand.sh", + + // Configure tool-specific properties. + "customizations": { + "vscode": { + "extensions": [ + "tauri-apps.tauri-vscode" + ] + } + }, + + "containerUser": "vscode" } diff --git a/.devcontainer/postCreateCommand.sh b/.devcontainer/postCreateCommand.sh new file mode 100755 index 000000000..9abfd0140 --- /dev/null +++ b/.devcontainer/postCreateCommand.sh @@ -0,0 +1,14 @@ +#!/bin/sh + +sudo apt update && sudo apt install -y --no-install-recommends \ + libwebkit2gtk-4.1-dev \ + build-essential \ + curl \ + wget \ + file \ + libssl-dev \ + libgtk-3-dev \ + libayatana-appindicator3-dev \ + librsvg2-dev + +cargo install tauri-cli@^2.0.0-beta diff --git a/.github/dependabot.yml b/.github/dependabot.yml new file mode 100644 index 000000000..f33a02cd1 --- /dev/null +++ b/.github/dependabot.yml @@ -0,0 +1,12 @@ +# To get started with Dependabot version updates, you'll need to specify which +# package ecosystems to update and where the package manifests are located. +# Please see the documentation for more information: +# https://docs.github.com/github/administering-a-repository/configuration-options-for-dependency-updates +# https://containers.dev/guide/dependabot + +version: 2 +updates: + - package-ecosystem: "devcontainers" + directory: "/" + schedule: + interval: weekly