mirror of
https://github.com/esphome/esphome.git
synced 2025-07-28 14:16:40 +00: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",
|
"name": "ESPHome Dev",
|
||||||
"image": "ghcr.io/esphome/esphome-lint:dev",
|
"context": "..",
|
||||||
|
"dockerFile": "Dockerfile",
|
||||||
"postCreateCommand": [
|
"postCreateCommand": [
|
||||||
"script/devcontainer-post-create"
|
"script/devcontainer-post-create"
|
||||||
],
|
],
|
||||||
"containerEnv": {
|
"features": {
|
||||||
"DEVCONTAINER": "1",
|
"ghcr.io/devcontainers/features/github-cli:1": {}
|
||||||
"PIP_BREAK_SYSTEM_PACKAGES": "1",
|
|
||||||
"PIP_ROOT_USER_ACTION": "ignore"
|
|
||||||
},
|
},
|
||||||
"runArgs": [
|
"runArgs": [
|
||||||
"--privileged",
|
"--privileged",
|
||||||
"-e",
|
"-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
|
// uncomment and edit the path in order to pass though local USB serial to the conatiner
|
||||||
// , "--device=/dev/ttyACM0"
|
// , "--device=/dev/ttyACM0"
|
||||||
],
|
],
|
||||||
|
@ -3,9 +3,6 @@
|
|||||||
set -e
|
set -e
|
||||||
# set -x
|
# set -x
|
||||||
|
|
||||||
apt update
|
|
||||||
apt-get install avahi-utils -y
|
|
||||||
|
|
||||||
mkdir -p config
|
mkdir -p config
|
||||||
script/setup
|
script/setup
|
||||||
|
|
||||||
|
@ -7,11 +7,7 @@ import sys
|
|||||||
|
|
||||||
|
|
||||||
def find_and_activate_virtualenv():
|
def find_and_activate_virtualenv():
|
||||||
if (
|
if "VIRTUAL_ENV" in os.environ:
|
||||||
("VIRTUAL_ENV" in os.environ)
|
|
||||||
or os.environ.get("DEVCONTAINER")
|
|
||||||
or os.environ.get("ESPHOME_NO_VENV")
|
|
||||||
):
|
|
||||||
return
|
return
|
||||||
|
|
||||||
try:
|
try:
|
||||||
|
@ -4,7 +4,7 @@
|
|||||||
set -e
|
set -e
|
||||||
|
|
||||||
cd "$(dirname "$0")/.."
|
cd "$(dirname "$0")/.."
|
||||||
if [ ! -n "$DEVCONTAINER" ] && [ ! -n "$VIRTUAL_ENV" ] && [ ! "$ESPHOME_NO_VENV" ]; then
|
if [ ! -n "$VIRTUAL_ENV" ]; then
|
||||||
if [ -x "$(command -v uv)" ]; then
|
if [ -x "$(command -v uv)" ]; then
|
||||||
uv venv venv
|
uv venv venv
|
||||||
else
|
else
|
||||||
|
@ -1,8 +1,6 @@
|
|||||||
@echo off
|
@echo off
|
||||||
|
|
||||||
if defined DEVCONTAINER goto :install
|
|
||||||
if defined VIRTUAL_ENV goto :install
|
if defined VIRTUAL_ENV goto :install
|
||||||
if defined ESPHOME_NO_VENV goto :install
|
|
||||||
|
|
||||||
echo Starting the Virtual Environment
|
echo Starting the Virtual Environment
|
||||||
python -m venv venv
|
python -m venv venv
|
||||||
|
Loading…
x
Reference in New Issue
Block a user