From b71d5135ce985c3a37f990965d1ee59f48cbfeaa Mon Sep 17 00:00:00 2001 From: Ubuntu Date: Wed, 18 Feb 2026 21:05:57 +0000 Subject: [PATCH] Add Notestation dev environment --- .devcontainer/notestation/Dockerfile | 17 ++++++ .devcontainer/notestation/devcontainer.json | 54 +++++++++++++++++++ .devcontainer/notestation/docker-compose.yaml | 40 ++++++++++++++ 3 files changed, 111 insertions(+) create mode 100644 .devcontainer/notestation/Dockerfile create mode 100644 .devcontainer/notestation/devcontainer.json create mode 100644 .devcontainer/notestation/docker-compose.yaml diff --git a/.devcontainer/notestation/Dockerfile b/.devcontainer/notestation/Dockerfile new file mode 100644 index 0000000..3aae514 --- /dev/null +++ b/.devcontainer/notestation/Dockerfile @@ -0,0 +1,17 @@ +FROM python:3.10-slim + +ARG USER="blues" + +RUN apt-get update && apt-get install -y \ + git \ + && rm -rf /var/lib/apt/lists/* && \ + useradd -ms /bin/bash ${USER} + +USER ${USER} + +WORKDIR /workspace + +RUN pip install pyserial requests + +# Install note-python in editable mode +CMD ["pip", "install", "-e", "."] diff --git a/.devcontainer/notestation/devcontainer.json b/.devcontainer/notestation/devcontainer.json new file mode 100644 index 0000000..acf4354 --- /dev/null +++ b/.devcontainer/notestation/devcontainer.json @@ -0,0 +1,54 @@ +// 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.205.2/containers/docker-existing-dockerfile +{ + "name": "Notestation Python Development Environment", + + // Use 'dockerComposeFile' to specify a docker-compose.yml file. + "dockerComposeFile": "docker-compose.yaml", + + // Set the service to use for the container. + "service": "devcontainer", + + // Use 'workspaceFolder' to specify the folder to open in the container. + "workspaceFolder": "/workspace", + + // Set environment variables inside the container(s) + "containerEnv": {}, + + // Set *default* container specific settings.json values on container create. + "customizations": { + "vscode": { + "extensions": [ + "ms-python.python", + "ms-python.vscode-pylance", + "shardulm94.trailing-spaces" + ], + "settings": {} + } + }, + + // Set environment variables for the container(s) + "remoteEnv": { + "BLUES": "${localEnv:BLUES}" + }, + + // Inject unique hostname into tailnet + "initializeCommand": "printf 'TS_HOSTNAME=vscode-client-%s\\n' \"${localEnv:USER}\" | tr '[:upper:]' '[:lower:]' | sed 's/^ts_hostname/TS_HOSTNAME/' > .devcontainer/notestation/ts_config.env", + + // Run commands after the container is created -> setup the execution environment + "postCreateCommand": "pip install -e .", + + // Use 'forwardPorts' to make a list of ports inside the container available locally. + // "forwardPorts": [], + + // Uncomment when using a ptrace-based debugger like C++, Go, and Rust + // "runArgs": [ + // "--device=/dev/bus/usb/" + // ], + + // Uncomment to use the Docker CLI from inside the container. See https://aka.ms/vscode-remote/samples/docker-from-docker. + // "mounts": [ "source=/var/run/docker.sock,target=/var/run/docker.sock,type=bind" ], + + // Uncomment to connect as a non-root user if you've added one. See https://aka.ms/vscode-remote/containers/non-root. + "remoteUser": "blues" +} diff --git a/.devcontainer/notestation/docker-compose.yaml b/.devcontainer/notestation/docker-compose.yaml new file mode 100644 index 0000000..7d37ca3 --- /dev/null +++ b/.devcontainer/notestation/docker-compose.yaml @@ -0,0 +1,40 @@ +# .devcontainer/docker-compose.yaml + +name: note-arduino +services: + devcontainer: + # image: ghcr.io/blues/note_arduino_ci:latest + build: + context: . + dockerfile: Dockerfile + container_name: note-arduino_devcontainer + command: sleep infinity + depends_on: + - tailscale + network_mode: service:tailscale # Share network with tailscale service + stdin_open: true + tty: true + volumes: + - ../..:/workspace:cached + + tailscale: + image: tailscale/tailscale:v1.90.6 + cap_add: + - NET_ADMIN # Network admin privileges + - SYS_MODULE # Required for TUN device + container_name: note-arduino_tailnet-connection + env_file: + - .env + - ts_config.env # Load Tailscale config from generated file + environment: + - TS_ACCEPT_DNS=true # Allows tailnet DNS resolution + # - TS_AUTHKEY= # DO NOT POPULATE - Loaded automatically from `.env` file + # - TS_HOSTNAME= # DO NOT POPULATE - Loaded automatically from `ts_config.env` + - TS_STATE_DIR=/var/lib/tailscale # Persist state + - TS_USERSPACE=false # Use kernel networking (faster; requires TUN device) + restart: unless-stopped + volumes: + - tailscale-var-lib:/var/lib/tailscale # Named volume for state + +volumes: + tailscale-var-lib: # Defines the named volume