Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 17 additions & 0 deletions .devcontainer/notestation/Dockerfile
Original file line number Diff line number Diff line change
@@ -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", "."]
54 changes: 54 additions & 0 deletions .devcontainer/notestation/devcontainer.json
Original file line number Diff line number Diff line change
@@ -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"
}
40 changes: 40 additions & 0 deletions .devcontainer/notestation/docker-compose.yaml
Original file line number Diff line number Diff line change
@@ -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
Loading