mirror of
https://github.com/esphome/esphome.git
synced 2025-06-14 22:36:58 +02:00
Updates for development environment (#8801)
This commit is contained in:
parent
1466aa7703
commit
bd7c2a680c
37
.devcontainer/Dockerfile
Normal file
37
.devcontainer/Dockerfile
Normal file
@ -0,0 +1,37 @@
|
||||
ARG BUILD_BASE_VERSION=2025.04.0
|
||||
|
||||
|
||||
FROM ghcr.io/esphome/docker-base:debian-${BUILD_BASE_VERSION} AS base
|
||||
|
||||
RUN git config --system --add safe.directory "*"
|
||||
|
||||
RUN apt update \
|
||||
&& apt install -y \
|
||||
protobuf-compiler
|
||||
|
||||
RUN pip install uv
|
||||
|
||||
RUN useradd esphome -m
|
||||
|
||||
USER esphome
|
||||
ENV VIRTUAL_ENV=/home/esphome/.local/esphome-venv
|
||||
RUN uv venv $VIRTUAL_ENV
|
||||
ENV PATH="$VIRTUAL_ENV/bin:$PATH"
|
||||
# Override this set to true in the docker-base image
|
||||
ENV UV_SYSTEM_PYTHON=false
|
||||
|
||||
WORKDIR /tmp
|
||||
|
||||
COPY requirements.txt ./
|
||||
RUN uv pip install -r requirements.txt
|
||||
COPY requirements_dev.txt requirements_test.txt ./
|
||||
RUN uv pip install -r requirements_dev.txt -r requirements_test.txt
|
||||
|
||||
RUN \
|
||||
platformio settings set enable_telemetry No \
|
||||
&& platformio settings set check_platformio_interval 1000000
|
||||
|
||||
COPY script/platformio_install_deps.py platformio.ini ./
|
||||
RUN ./platformio_install_deps.py platformio.ini --libraries --platforms --tools
|
||||
|
||||
WORKDIR /workspaces
|
@ -1,18 +1,17 @@
|
||||
{
|
||||
"name": "ESPHome Dev",
|
||||
"image": "ghcr.io/esphome/esphome-lint:dev",
|
||||
"context": "..",
|
||||
"dockerFile": "Dockerfile",
|
||||
"postCreateCommand": [
|
||||
"script/devcontainer-post-create"
|
||||
],
|
||||
"containerEnv": {
|
||||
"DEVCONTAINER": "1",
|
||||
"PIP_BREAK_SYSTEM_PACKAGES": "1",
|
||||
"PIP_ROOT_USER_ACTION": "ignore"
|
||||
"features": {
|
||||
"ghcr.io/devcontainers/features/github-cli:1": {}
|
||||
},
|
||||
"runArgs": [
|
||||
"--privileged",
|
||||
"-e",
|
||||
"ESPHOME_DASHBOARD_USE_PING=1"
|
||||
"GIT_EDITOR=code --wait"
|
||||
// uncomment and edit the path in order to pass though local USB serial to the conatiner
|
||||
// , "--device=/dev/ttyACM0"
|
||||
],
|
||||
|
@ -3,9 +3,6 @@
|
||||
set -e
|
||||
# set -x
|
||||
|
||||
apt update
|
||||
apt-get install avahi-utils -y
|
||||
|
||||
mkdir -p config
|
||||
script/setup
|
||||
|
||||
|
@ -7,11 +7,7 @@ import sys
|
||||
|
||||
|
||||
def find_and_activate_virtualenv():
|
||||
if (
|
||||
("VIRTUAL_ENV" in os.environ)
|
||||
or os.environ.get("DEVCONTAINER")
|
||||
or os.environ.get("ESPHOME_NO_VENV")
|
||||
):
|
||||
if "VIRTUAL_ENV" in os.environ:
|
||||
return
|
||||
|
||||
try:
|
||||
|
@ -4,7 +4,7 @@
|
||||
set -e
|
||||
|
||||
cd "$(dirname "$0")/.."
|
||||
if [ ! -n "$DEVCONTAINER" ] && [ ! -n "$VIRTUAL_ENV" ] && [ ! "$ESPHOME_NO_VENV" ]; then
|
||||
if [ ! -n "$VIRTUAL_ENV" ]; then
|
||||
if [ -x "$(command -v uv)" ]; then
|
||||
uv venv venv
|
||||
else
|
||||
|
@ -1,8 +1,6 @@
|
||||
@echo off
|
||||
|
||||
if defined DEVCONTAINER goto :install
|
||||
if defined VIRTUAL_ENV goto :install
|
||||
if defined ESPHOME_NO_VENV goto :install
|
||||
|
||||
echo Starting the Virtual Environment
|
||||
python -m venv venv
|
||||
|
Loading…
x
Reference in New Issue
Block a user