mirror of
https://github.com/esphome/esphome.git
synced 2025-07-26 21:26:41 +00:00
[docker] Use new base container image (#8582)
This commit is contained in:
parent
4c8f5275f9
commit
adcd6517db
@ -114,4 +114,5 @@ config/
|
|||||||
examples/
|
examples/
|
||||||
Dockerfile
|
Dockerfile
|
||||||
.git/
|
.git/
|
||||||
tests/build/
|
tests/
|
||||||
|
.*
|
||||||
|
29
.github/actions/build-image/action.yaml
vendored
29
.github/actions/build-image/action.yaml
vendored
@ -1,15 +1,11 @@
|
|||||||
name: Build Image
|
name: Build Image
|
||||||
inputs:
|
inputs:
|
||||||
platform:
|
|
||||||
description: "Platform to build for"
|
|
||||||
required: true
|
|
||||||
example: "linux/amd64"
|
|
||||||
target:
|
target:
|
||||||
description: "Target to build"
|
description: "Target to build"
|
||||||
required: true
|
required: true
|
||||||
example: "docker"
|
example: "docker"
|
||||||
baseimg:
|
build_type:
|
||||||
description: "Base image type"
|
description: "Build type"
|
||||||
required: true
|
required: true
|
||||||
example: "docker"
|
example: "docker"
|
||||||
suffix:
|
suffix:
|
||||||
@ -19,6 +15,11 @@ inputs:
|
|||||||
description: "Version to build"
|
description: "Version to build"
|
||||||
required: true
|
required: true
|
||||||
example: "2023.12.0"
|
example: "2023.12.0"
|
||||||
|
base_os:
|
||||||
|
description: "Base OS to use"
|
||||||
|
required: false
|
||||||
|
default: "debian"
|
||||||
|
example: "debian"
|
||||||
runs:
|
runs:
|
||||||
using: "composite"
|
using: "composite"
|
||||||
steps:
|
steps:
|
||||||
@ -53,22 +54,22 @@ runs:
|
|||||||
with:
|
with:
|
||||||
context: .
|
context: .
|
||||||
file: ./docker/Dockerfile
|
file: ./docker/Dockerfile
|
||||||
platforms: ${{ inputs.platform }}
|
|
||||||
target: ${{ inputs.target }}
|
target: ${{ inputs.target }}
|
||||||
cache-from: type=gha
|
cache-from: type=gha
|
||||||
cache-to: ${{ steps.cache-to.outputs.value }}
|
cache-to: ${{ steps.cache-to.outputs.value }}
|
||||||
build-args: |
|
build-args: |
|
||||||
BASEIMGTYPE=${{ inputs.baseimg }}
|
BUILD_TYPE=${{ inputs.build_type }}
|
||||||
BUILD_VERSION=${{ inputs.version }}
|
BUILD_VERSION=${{ inputs.version }}
|
||||||
|
BUILD_OS=${{ inputs.base_os }}
|
||||||
outputs: |
|
outputs: |
|
||||||
type=image,name=ghcr.io/${{ steps.tags.outputs.image_name }},push-by-digest=true,name-canonical=true,push=true
|
type=image,name=ghcr.io/${{ steps.tags.outputs.image_name }},push-by-digest=true,name-canonical=true,push=true
|
||||||
|
|
||||||
- name: Export ghcr digests
|
- name: Export ghcr digests
|
||||||
shell: bash
|
shell: bash
|
||||||
run: |
|
run: |
|
||||||
mkdir -p /tmp/digests/${{ inputs.target }}/ghcr
|
mkdir -p /tmp/digests/${{ inputs.build_type }}/ghcr
|
||||||
digest="${{ steps.build-ghcr.outputs.digest }}"
|
digest="${{ steps.build-ghcr.outputs.digest }}"
|
||||||
touch "/tmp/digests/${{ inputs.target }}/ghcr/${digest#sha256:}"
|
touch "/tmp/digests/${{ inputs.build_type }}/ghcr/${digest#sha256:}"
|
||||||
|
|
||||||
- name: Build and push to dockerhub by digest
|
- name: Build and push to dockerhub by digest
|
||||||
id: build-dockerhub
|
id: build-dockerhub
|
||||||
@ -79,19 +80,19 @@ runs:
|
|||||||
with:
|
with:
|
||||||
context: .
|
context: .
|
||||||
file: ./docker/Dockerfile
|
file: ./docker/Dockerfile
|
||||||
platforms: ${{ inputs.platform }}
|
|
||||||
target: ${{ inputs.target }}
|
target: ${{ inputs.target }}
|
||||||
cache-from: type=gha
|
cache-from: type=gha
|
||||||
cache-to: ${{ steps.cache-to.outputs.value }}
|
cache-to: ${{ steps.cache-to.outputs.value }}
|
||||||
build-args: |
|
build-args: |
|
||||||
BASEIMGTYPE=${{ inputs.baseimg }}
|
BUILD_TYPE=${{ inputs.build_type }}
|
||||||
BUILD_VERSION=${{ inputs.version }}
|
BUILD_VERSION=${{ inputs.version }}
|
||||||
|
BUILD_OS=${{ inputs.base_os }}
|
||||||
outputs: |
|
outputs: |
|
||||||
type=image,name=docker.io/${{ steps.tags.outputs.image_name }},push-by-digest=true,name-canonical=true,push=true
|
type=image,name=docker.io/${{ steps.tags.outputs.image_name }},push-by-digest=true,name-canonical=true,push=true
|
||||||
|
|
||||||
- name: Export dockerhub digests
|
- name: Export dockerhub digests
|
||||||
shell: bash
|
shell: bash
|
||||||
run: |
|
run: |
|
||||||
mkdir -p /tmp/digests/${{ inputs.target }}/dockerhub
|
mkdir -p /tmp/digests/${{ inputs.build_type }}/dockerhub
|
||||||
digest="${{ steps.build-dockerhub.outputs.digest }}"
|
digest="${{ steps.build-dockerhub.outputs.digest }}"
|
||||||
touch "/tmp/digests/${{ inputs.target }}/dockerhub/${digest#sha256:}"
|
touch "/tmp/digests/${{ inputs.build_type }}/dockerhub/${digest#sha256:}"
|
||||||
|
4
.github/actions/restore-python/action.yml
vendored
4
.github/actions/restore-python/action.yml
vendored
@ -34,7 +34,7 @@ runs:
|
|||||||
python -m venv venv
|
python -m venv venv
|
||||||
source venv/bin/activate
|
source venv/bin/activate
|
||||||
python --version
|
python --version
|
||||||
pip install -r requirements.txt -r requirements_optional.txt -r requirements_test.txt
|
pip install -r requirements.txt -r requirements_test.txt
|
||||||
pip install -e .
|
pip install -e .
|
||||||
- name: Create Python virtual environment
|
- name: Create Python virtual environment
|
||||||
if: steps.cache-venv.outputs.cache-hit != 'true' && runner.os == 'Windows'
|
if: steps.cache-venv.outputs.cache-hit != 'true' && runner.os == 'Windows'
|
||||||
@ -43,5 +43,5 @@ runs:
|
|||||||
python -m venv venv
|
python -m venv venv
|
||||||
./venv/Scripts/activate
|
./venv/Scripts/activate
|
||||||
python --version
|
python --version
|
||||||
pip install -r requirements.txt -r requirements_optional.txt -r requirements_test.txt
|
pip install -r requirements.txt -r requirements_test.txt
|
||||||
pip install -e .
|
pip install -e .
|
||||||
|
1
.github/dependabot.yml
vendored
1
.github/dependabot.yml
vendored
@ -17,7 +17,6 @@ updates:
|
|||||||
docker-actions:
|
docker-actions:
|
||||||
applies-to: version-updates
|
applies-to: version-updates
|
||||||
patterns:
|
patterns:
|
||||||
- "docker/setup-qemu-action"
|
|
||||||
- "docker/login-action"
|
- "docker/login-action"
|
||||||
- "docker/setup-buildx-action"
|
- "docker/setup-buildx-action"
|
||||||
- package-ecosystem: github-actions
|
- package-ecosystem: github-actions
|
||||||
|
7
.github/workflows/ci-docker.yml
vendored
7
.github/workflows/ci-docker.yml
vendored
@ -37,8 +37,11 @@ jobs:
|
|||||||
strategy:
|
strategy:
|
||||||
fail-fast: false
|
fail-fast: false
|
||||||
matrix:
|
matrix:
|
||||||
os: ["ubuntu-latest", "ubuntu-24.04-arm"]
|
os: ["ubuntu-24.04", "ubuntu-24.04-arm"]
|
||||||
build_type: ["ha-addon", "docker", "lint"]
|
build_type:
|
||||||
|
- "ha-addon"
|
||||||
|
- "docker"
|
||||||
|
# - "lint"
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v4.1.7
|
- uses: actions/checkout@v4.1.7
|
||||||
- name: Set up Python
|
- name: Set up Python
|
||||||
|
4
.github/workflows/ci.yml
vendored
4
.github/workflows/ci.yml
vendored
@ -39,7 +39,7 @@ jobs:
|
|||||||
uses: actions/checkout@v4.1.7
|
uses: actions/checkout@v4.1.7
|
||||||
- name: Generate cache-key
|
- name: Generate cache-key
|
||||||
id: cache-key
|
id: cache-key
|
||||||
run: echo key="${{ hashFiles('requirements.txt', 'requirements_optional.txt', 'requirements_test.txt') }}" >> $GITHUB_OUTPUT
|
run: echo key="${{ hashFiles('requirements.txt', 'requirements_test.txt') }}" >> $GITHUB_OUTPUT
|
||||||
- name: Set up Python ${{ env.DEFAULT_PYTHON }}
|
- name: Set up Python ${{ env.DEFAULT_PYTHON }}
|
||||||
id: python
|
id: python
|
||||||
uses: actions/setup-python@v5.6.0
|
uses: actions/setup-python@v5.6.0
|
||||||
@ -58,7 +58,7 @@ jobs:
|
|||||||
python -m venv venv
|
python -m venv venv
|
||||||
. venv/bin/activate
|
. venv/bin/activate
|
||||||
python --version
|
python --version
|
||||||
pip install -r requirements.txt -r requirements_optional.txt -r requirements_test.txt
|
pip install -r requirements.txt -r requirements_test.txt
|
||||||
pip install -e .
|
pip install -e .
|
||||||
|
|
||||||
ruff:
|
ruff:
|
||||||
|
64
.github/workflows/release.yml
vendored
64
.github/workflows/release.yml
vendored
@ -68,19 +68,22 @@ jobs:
|
|||||||
uses: pypa/gh-action-pypi-publish@v1.12.4
|
uses: pypa/gh-action-pypi-publish@v1.12.4
|
||||||
|
|
||||||
deploy-docker:
|
deploy-docker:
|
||||||
name: Build ESPHome ${{ matrix.platform }}
|
name: Build ESPHome ${{ matrix.platform.arch }}
|
||||||
if: github.repository == 'esphome/esphome'
|
if: github.repository == 'esphome/esphome'
|
||||||
permissions:
|
permissions:
|
||||||
contents: read
|
contents: read
|
||||||
packages: write
|
packages: write
|
||||||
runs-on: ubuntu-latest
|
runs-on: ${{ matrix.platform.os }}
|
||||||
needs: [init]
|
needs: [init]
|
||||||
strategy:
|
strategy:
|
||||||
fail-fast: false
|
fail-fast: false
|
||||||
matrix:
|
matrix:
|
||||||
platform:
|
platform:
|
||||||
- linux/amd64
|
- arch: amd64
|
||||||
- linux/arm64
|
os: "ubuntu-24.04"
|
||||||
|
- arch: arm64
|
||||||
|
os: "ubuntu-24.04-arm"
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v4.1.7
|
- uses: actions/checkout@v4.1.7
|
||||||
- name: Set up Python
|
- name: Set up Python
|
||||||
@ -90,9 +93,6 @@ jobs:
|
|||||||
|
|
||||||
- name: Set up Docker Buildx
|
- name: Set up Docker Buildx
|
||||||
uses: docker/setup-buildx-action@v3.10.0
|
uses: docker/setup-buildx-action@v3.10.0
|
||||||
- name: Set up QEMU
|
|
||||||
if: matrix.platform != 'linux/amd64'
|
|
||||||
uses: docker/setup-qemu-action@v3.6.0
|
|
||||||
|
|
||||||
- name: Log in to docker hub
|
- name: Log in to docker hub
|
||||||
uses: docker/login-action@v3.4.0
|
uses: docker/login-action@v3.4.0
|
||||||
@ -109,45 +109,36 @@ jobs:
|
|||||||
- name: Build docker
|
- name: Build docker
|
||||||
uses: ./.github/actions/build-image
|
uses: ./.github/actions/build-image
|
||||||
with:
|
with:
|
||||||
platform: ${{ matrix.platform }}
|
target: final
|
||||||
target: docker
|
build_type: docker
|
||||||
baseimg: docker
|
|
||||||
suffix: ""
|
suffix: ""
|
||||||
version: ${{ needs.init.outputs.tag }}
|
version: ${{ needs.init.outputs.tag }}
|
||||||
|
|
||||||
- name: Build ha-addon
|
- name: Build ha-addon
|
||||||
uses: ./.github/actions/build-image
|
uses: ./.github/actions/build-image
|
||||||
with:
|
with:
|
||||||
platform: ${{ matrix.platform }}
|
target: final
|
||||||
target: hassio
|
build_type: ha-addon
|
||||||
baseimg: hassio
|
|
||||||
suffix: "hassio"
|
suffix: "hassio"
|
||||||
version: ${{ needs.init.outputs.tag }}
|
version: ${{ needs.init.outputs.tag }}
|
||||||
|
|
||||||
- name: Build lint
|
# - name: Build lint
|
||||||
uses: ./.github/actions/build-image
|
# uses: ./.github/actions/build-image
|
||||||
with:
|
# with:
|
||||||
platform: ${{ matrix.platform }}
|
# target: lint
|
||||||
target: lint
|
# build_type: lint
|
||||||
baseimg: docker
|
# suffix: lint
|
||||||
suffix: lint
|
# version: ${{ needs.init.outputs.tag }}
|
||||||
version: ${{ needs.init.outputs.tag }}
|
|
||||||
|
|
||||||
- name: Sanitize platform name
|
|
||||||
id: sanitize
|
|
||||||
run: |
|
|
||||||
echo "${{ matrix.platform }}" | sed 's|/|-|g' > /tmp/platform
|
|
||||||
echo name=$(cat /tmp/platform) >> $GITHUB_OUTPUT
|
|
||||||
|
|
||||||
- name: Upload digests
|
- name: Upload digests
|
||||||
uses: actions/upload-artifact@v4.6.2
|
uses: actions/upload-artifact@v4.6.2
|
||||||
with:
|
with:
|
||||||
name: digests-${{ steps.sanitize.outputs.name }}
|
name: digests-${{ matrix.platform.arch }}
|
||||||
path: /tmp/digests
|
path: /tmp/digests
|
||||||
retention-days: 1
|
retention-days: 1
|
||||||
|
|
||||||
deploy-manifest:
|
deploy-manifest:
|
||||||
name: Publish ESPHome ${{ matrix.image.title }} to ${{ matrix.registry }}
|
name: Publish ESPHome ${{ matrix.image.build_type }} to ${{ matrix.registry }}
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
needs:
|
needs:
|
||||||
- init
|
- init
|
||||||
@ -160,15 +151,12 @@ jobs:
|
|||||||
fail-fast: false
|
fail-fast: false
|
||||||
matrix:
|
matrix:
|
||||||
image:
|
image:
|
||||||
- title: "ha-addon"
|
- build_type: "docker"
|
||||||
target: "hassio"
|
|
||||||
suffix: "hassio"
|
|
||||||
- title: "docker"
|
|
||||||
target: "docker"
|
|
||||||
suffix: ""
|
suffix: ""
|
||||||
- title: "lint"
|
- build_type: "ha-addon"
|
||||||
target: "lint"
|
suffix: "hassio"
|
||||||
suffix: "lint"
|
# - build_type: "lint"
|
||||||
|
# suffix: "lint"
|
||||||
registry:
|
registry:
|
||||||
- ghcr
|
- ghcr
|
||||||
- dockerhub
|
- dockerhub
|
||||||
@ -212,7 +200,7 @@ jobs:
|
|||||||
done
|
done
|
||||||
|
|
||||||
- name: Create manifest list and push
|
- name: Create manifest list and push
|
||||||
working-directory: /tmp/digests/${{ matrix.image.target }}/${{ matrix.registry }}
|
working-directory: /tmp/digests/${{ matrix.image.build_type }}/${{ matrix.registry }}
|
||||||
run: |
|
run: |
|
||||||
docker buildx imagetools create $(jq -Rcnr 'inputs | . / "," | map("-t " + .) | join(" ")' <<< "${{ steps.tags.outputs.tags}}") \
|
docker buildx imagetools create $(jq -Rcnr 'inputs | . / "," | map("-t " + .) | join(" ")' <<< "${{ steps.tags.outputs.tags}}") \
|
||||||
$(printf '${{ steps.tags.outputs.image }}@sha256:%s ' *)
|
$(printf '${{ steps.tags.outputs.image }}@sha256:%s ' *)
|
||||||
|
@ -1,124 +1,47 @@
|
|||||||
# Build these with the build.py script
|
ARG BUILD_VERSION=dev
|
||||||
# Example:
|
ARG BUILD_OS=alpine
|
||||||
# python3 docker/build.py --tag dev --arch amd64 --build-type docker build
|
ARG BUILD_BASE_VERSION=2025.04.0
|
||||||
|
ARG BUILD_TYPE=docker
|
||||||
|
|
||||||
# One of "docker", "hassio"
|
FROM ghcr.io/esphome/docker-base:${BUILD_OS}-${BUILD_BASE_VERSION} AS base-source-docker
|
||||||
ARG BASEIMGTYPE=docker
|
FROM ghcr.io/esphome/docker-base:${BUILD_OS}-ha-addon-${BUILD_BASE_VERSION} AS base-source-ha-addon
|
||||||
|
|
||||||
|
ARG BUILD_TYPE
|
||||||
|
FROM base-source-${BUILD_TYPE} AS base
|
||||||
|
|
||||||
# https://github.com/hassio-addons/addon-debian-base/releases
|
RUN git config --system --add safe.directory "*"
|
||||||
FROM ghcr.io/hassio-addons/debian-base:7.2.0 AS base-hassio
|
|
||||||
# https://hub.docker.com/_/debian?tab=tags&page=1&name=bookworm
|
|
||||||
FROM debian:12.2-slim AS base-docker
|
|
||||||
|
|
||||||
FROM base-${BASEIMGTYPE} AS base
|
RUN pip install uv==0.6.14
|
||||||
|
|
||||||
|
COPY requirements.txt /
|
||||||
ARG TARGETARCH
|
|
||||||
ARG TARGETVARIANT
|
|
||||||
|
|
||||||
|
|
||||||
# Note that --break-system-packages is used below because
|
|
||||||
# https://peps.python.org/pep-0668/ added a safety check that prevents
|
|
||||||
# installing packages with the same name as a system package. This is
|
|
||||||
# not a problem for us because we are not concerned about overwriting
|
|
||||||
# system packages because we are running in an isolated container.
|
|
||||||
|
|
||||||
RUN \
|
RUN \
|
||||||
apt-get update \
|
uv pip install --no-cache-dir \
|
||||||
# Use pinned versions so that we get updates with build caching
|
-r /requirements.txt
|
||||||
&& apt-get install -y --no-install-recommends \
|
|
||||||
python3-pip=23.0.1+dfsg-1 \
|
|
||||||
python3-setuptools=66.1.1-1+deb12u1 \
|
|
||||||
python3-venv=3.11.2-1+b1 \
|
|
||||||
python3-wheel=0.38.4-2 \
|
|
||||||
iputils-ping=3:20221126-1+deb12u1 \
|
|
||||||
git=1:2.39.5-0+deb12u2 \
|
|
||||||
curl=7.88.1-10+deb12u12 \
|
|
||||||
openssh-client=1:9.2p1-2+deb12u5 \
|
|
||||||
python3-cffi=1.15.1-5 \
|
|
||||||
libcairo2=1.16.0-7 \
|
|
||||||
libmagic1=1:5.44-3 \
|
|
||||||
patch=2.7.6-7 \
|
|
||||||
&& rm -rf \
|
|
||||||
/tmp/* \
|
|
||||||
/var/{cache,log}/* \
|
|
||||||
/var/lib/apt/lists/*
|
|
||||||
|
|
||||||
ENV \
|
|
||||||
# Fix click python3 lang warning https://click.palletsprojects.com/en/7.x/python3/
|
|
||||||
LANG=C.UTF-8 LC_ALL=C.UTF-8 \
|
|
||||||
# Store globally installed pio libs in /piolibs
|
|
||||||
PLATFORMIO_GLOBALLIB_DIR=/piolibs
|
|
||||||
|
|
||||||
RUN \
|
RUN \
|
||||||
pip3 install \
|
platformio settings set enable_telemetry No \
|
||||||
--break-system-packages --no-cache-dir \
|
|
||||||
# Keep platformio version in sync with requirements.txt
|
|
||||||
platformio==6.1.18 \
|
|
||||||
# Change some platformio settings
|
|
||||||
&& platformio settings set enable_telemetry No \
|
|
||||||
&& platformio settings set check_platformio_interval 1000000 \
|
&& platformio settings set check_platformio_interval 1000000 \
|
||||||
&& mkdir -p /piolibs
|
&& mkdir -p /piolibs
|
||||||
|
|
||||||
|
|
||||||
# First install requirements to leverage caching when requirements don't change
|
|
||||||
# tmpfs is for https://github.com/rust-lang/cargo/issues/8719
|
|
||||||
|
|
||||||
COPY requirements.txt requirements_optional.txt /
|
|
||||||
RUN --mount=type=tmpfs,target=/root/.cargo <<END-OF-RUN
|
|
||||||
# Fail on any non-zero status
|
|
||||||
set -e
|
|
||||||
|
|
||||||
# install build tools in case wheels are not available
|
|
||||||
BUILD_DEPS="
|
|
||||||
build-essential=12.9
|
|
||||||
python3-dev=3.11.2-1+b1
|
|
||||||
zlib1g-dev=1:1.2.13.dfsg-1
|
|
||||||
libjpeg-dev=1:2.1.5-2
|
|
||||||
libfreetype-dev=2.12.1+dfsg-5+deb12u4
|
|
||||||
libssl-dev=3.0.15-1~deb12u1
|
|
||||||
libffi-dev=3.4.4-1
|
|
||||||
cargo=0.66.0+ds1-1
|
|
||||||
pkg-config=1.8.1-1
|
|
||||||
"
|
|
||||||
LIB_DEPS="
|
|
||||||
libtiff6=4.5.0-6+deb12u1
|
|
||||||
libopenjp2-7=2.5.0-2+deb12u1
|
|
||||||
"
|
|
||||||
if [ "$TARGETARCH$TARGETVARIANT" = "arm64" ]
|
|
||||||
then
|
|
||||||
apt-get update
|
|
||||||
apt-get install -y --no-install-recommends $BUILD_DEPS $LIB_DEPS
|
|
||||||
fi
|
|
||||||
|
|
||||||
CARGO_REGISTRIES_CRATES_IO_PROTOCOL=sparse CARGO_HOME=/root/.cargo
|
|
||||||
pip3 install --break-system-packages --no-cache-dir -r /requirements.txt -r /requirements_optional.txt
|
|
||||||
|
|
||||||
if [ "$TARGETARCH$TARGETVARIANT" = "arm64" ]
|
|
||||||
then
|
|
||||||
apt-get remove -y --purge --auto-remove $BUILD_DEPS
|
|
||||||
rm -rf /tmp/* /var/{cache,log}/* /var/lib/apt/lists/*
|
|
||||||
fi
|
|
||||||
END-OF-RUN
|
|
||||||
|
|
||||||
|
|
||||||
COPY script/platformio_install_deps.py platformio.ini /
|
COPY script/platformio_install_deps.py platformio.ini /
|
||||||
RUN /platformio_install_deps.py /platformio.ini --libraries
|
RUN /platformio_install_deps.py /platformio.ini --libraries
|
||||||
|
|
||||||
# Avoid unsafe git error when container user and file config volume permissions don't match
|
ARG BUILD_VERSION
|
||||||
RUN git config --system --add safe.directory '*'
|
|
||||||
|
LABEL \
|
||||||
|
org.opencontainers.image.authors="The ESPHome Authors" \
|
||||||
|
org.opencontainers.image.title="ESPHome" \
|
||||||
|
org.opencontainers.image.description="ESPHome is a system to configure your microcontrollers by simple yet powerful configuration files and control them remotely through Home Automation systems" \
|
||||||
|
org.opencontainers.image.url="https://esphome.io/" \
|
||||||
|
org.opencontainers.image.documentation="https://esphome.io/" \
|
||||||
|
org.opencontainers.image.source="https://github.com/esphome/esphome" \
|
||||||
|
org.opencontainers.image.licenses="ESPHome" \
|
||||||
|
org.opencontainers.image.version=${BUILD_VERSION}
|
||||||
|
|
||||||
|
|
||||||
# ======================= docker-type image =======================
|
# ======================= docker-type image =======================
|
||||||
FROM base AS docker
|
FROM base AS base-docker
|
||||||
|
|
||||||
# Copy esphome and install
|
|
||||||
COPY . /esphome
|
|
||||||
RUN pip3 install --break-system-packages --no-cache-dir -e /esphome
|
|
||||||
|
|
||||||
# Settings for dashboard
|
|
||||||
ENV USERNAME="" PASSWORD=""
|
|
||||||
|
|
||||||
# Expose the dashboard to Docker
|
# Expose the dashboard to Docker
|
||||||
EXPOSE 6052
|
EXPOSE 6052
|
||||||
@ -139,43 +62,13 @@ ENTRYPOINT ["/entrypoint.sh"]
|
|||||||
CMD ["dashboard", "/config"]
|
CMD ["dashboard", "/config"]
|
||||||
|
|
||||||
|
|
||||||
ARG BUILD_VERSION=dev
|
# ======================= ha-addon-type image =======================
|
||||||
|
FROM base AS base-ha-addon
|
||||||
# Labels
|
|
||||||
LABEL \
|
|
||||||
org.opencontainers.image.authors="The ESPHome Authors" \
|
|
||||||
org.opencontainers.image.title="ESPHome" \
|
|
||||||
org.opencontainers.image.description="ESPHome is a system to configure your microcontrollers by simple yet powerful configuration files and control them remotely through Home Automation systems" \
|
|
||||||
org.opencontainers.image.url="https://esphome.io/" \
|
|
||||||
org.opencontainers.image.documentation="https://esphome.io/" \
|
|
||||||
org.opencontainers.image.source="https://github.com/esphome/esphome" \
|
|
||||||
org.opencontainers.image.licenses="ESPHome" \
|
|
||||||
org.opencontainers.image.version=${BUILD_VERSION}
|
|
||||||
|
|
||||||
|
|
||||||
# ======================= hassio-type image =======================
|
|
||||||
FROM base AS hassio
|
|
||||||
|
|
||||||
RUN \
|
|
||||||
apt-get update \
|
|
||||||
# Use pinned versions so that we get updates with build caching
|
|
||||||
&& apt-get install -y --no-install-recommends \
|
|
||||||
nginx-light=1.22.1-9+deb12u1 \
|
|
||||||
&& rm -rf \
|
|
||||||
/tmp/* \
|
|
||||||
/var/{cache,log}/* \
|
|
||||||
/var/lib/apt/lists/*
|
|
||||||
|
|
||||||
ARG BUILD_VERSION=dev
|
|
||||||
|
|
||||||
# Copy root filesystem
|
# Copy root filesystem
|
||||||
COPY docker/ha-addon-rootfs/ /
|
COPY docker/ha-addon-rootfs/ /
|
||||||
|
|
||||||
# Copy esphome and install
|
ARG BUILD_VERSION
|
||||||
COPY . /esphome
|
|
||||||
RUN pip3 install --break-system-packages --no-cache-dir -e /esphome
|
|
||||||
|
|
||||||
# Labels
|
|
||||||
LABEL \
|
LABEL \
|
||||||
io.hass.name="ESPHome" \
|
io.hass.name="ESPHome" \
|
||||||
io.hass.description="ESPHome is a system to configure your microcontrollers by simple yet powerful configuration files and control them remotely through Home Automation systems" \
|
io.hass.description="ESPHome is a system to configure your microcontrollers by simple yet powerful configuration files and control them remotely through Home Automation systems" \
|
||||||
@ -183,35 +76,9 @@ LABEL \
|
|||||||
io.hass.version="${BUILD_VERSION}"
|
io.hass.version="${BUILD_VERSION}"
|
||||||
# io.hass.arch is inherited from addon-debian-base
|
# io.hass.arch is inherited from addon-debian-base
|
||||||
|
|
||||||
|
ARG BUILD_TYPE
|
||||||
|
FROM base-${BUILD_TYPE} AS final
|
||||||
|
|
||||||
|
# Copy esphome and install
|
||||||
|
COPY . /esphome
|
||||||
# ======================= lint-type image =======================
|
RUN uv pip install --no-cache-dir -e /esphome
|
||||||
FROM base AS lint
|
|
||||||
|
|
||||||
ENV \
|
|
||||||
PLATFORMIO_CORE_DIR=/esphome/.temp/platformio
|
|
||||||
|
|
||||||
RUN \
|
|
||||||
curl -L https://apt.llvm.org/llvm-snapshot.gpg.key -o /etc/apt/trusted.gpg.d/apt.llvm.org.asc \
|
|
||||||
&& echo "deb http://apt.llvm.org/bookworm/ llvm-toolchain-bookworm-18 main" > /etc/apt/sources.list.d/llvm.sources.list \
|
|
||||||
&& apt-get update \
|
|
||||||
# Use pinned versions so that we get updates with build caching
|
|
||||||
&& apt-get install -y --no-install-recommends \
|
|
||||||
clang-format-13=1:13.0.1-11+b2 \
|
|
||||||
patch=2.7.6-7 \
|
|
||||||
software-properties-common=0.99.30-4.1~deb12u1 \
|
|
||||||
nano=7.2-1+deb12u1 \
|
|
||||||
build-essential=12.9 \
|
|
||||||
python3-dev=3.11.2-1+b1 \
|
|
||||||
clang-tidy-18=1:18.1.8~++20240731024826+3b5b5c1ec4a3-1~exp1~20240731144843.145 \
|
|
||||||
&& rm -rf \
|
|
||||||
/tmp/* \
|
|
||||||
/var/{cache,log}/* \
|
|
||||||
/var/lib/apt/lists/*
|
|
||||||
|
|
||||||
COPY requirements_test.txt /
|
|
||||||
RUN pip3 install --break-system-packages --no-cache-dir -r /requirements_test.txt
|
|
||||||
|
|
||||||
VOLUME ["/esphome"]
|
|
||||||
WORKDIR /esphome
|
|
||||||
|
@ -54,7 +54,7 @@ manifest_parser = subparsers.add_parser(
|
|||||||
class DockerParams:
|
class DockerParams:
|
||||||
build_to: str
|
build_to: str
|
||||||
manifest_to: str
|
manifest_to: str
|
||||||
baseimgtype: str
|
build_type: str
|
||||||
platform: str
|
platform: str
|
||||||
target: str
|
target: str
|
||||||
|
|
||||||
@ -66,24 +66,19 @@ class DockerParams:
|
|||||||
TYPE_LINT: "esphome/esphome-lint",
|
TYPE_LINT: "esphome/esphome-lint",
|
||||||
}[build_type]
|
}[build_type]
|
||||||
build_to = f"{prefix}-{arch}"
|
build_to = f"{prefix}-{arch}"
|
||||||
baseimgtype = {
|
|
||||||
TYPE_DOCKER: "docker",
|
|
||||||
TYPE_HA_ADDON: "hassio",
|
|
||||||
TYPE_LINT: "docker",
|
|
||||||
}[build_type]
|
|
||||||
platform = {
|
platform = {
|
||||||
ARCH_AMD64: "linux/amd64",
|
ARCH_AMD64: "linux/amd64",
|
||||||
ARCH_AARCH64: "linux/arm64",
|
ARCH_AARCH64: "linux/arm64",
|
||||||
}[arch]
|
}[arch]
|
||||||
target = {
|
target = {
|
||||||
TYPE_DOCKER: "docker",
|
TYPE_DOCKER: "final",
|
||||||
TYPE_HA_ADDON: "hassio",
|
TYPE_HA_ADDON: "final",
|
||||||
TYPE_LINT: "lint",
|
TYPE_LINT: "lint",
|
||||||
}[build_type]
|
}[build_type]
|
||||||
return cls(
|
return cls(
|
||||||
build_to=build_to,
|
build_to=build_to,
|
||||||
manifest_to=prefix,
|
manifest_to=prefix,
|
||||||
baseimgtype=baseimgtype,
|
build_type=build_type,
|
||||||
platform=platform,
|
platform=platform,
|
||||||
target=target,
|
target=target,
|
||||||
)
|
)
|
||||||
@ -145,7 +140,7 @@ def main():
|
|||||||
"buildx",
|
"buildx",
|
||||||
"build",
|
"build",
|
||||||
"--build-arg",
|
"--build-arg",
|
||||||
f"BASEIMGTYPE={params.baseimgtype}",
|
f"BUILD_TYPE={params.build_type}",
|
||||||
"--build-arg",
|
"--build-arg",
|
||||||
f"BUILD_VERSION={args.tag}",
|
f"BUILD_VERSION={args.tag}",
|
||||||
"--cache-from",
|
"--cache-from",
|
||||||
|
@ -48,7 +48,6 @@ version = {attr = "esphome.const.__version__"}
|
|||||||
[tool.setuptools.dynamic.optional-dependencies]
|
[tool.setuptools.dynamic.optional-dependencies]
|
||||||
dev = { file = ["requirements_dev.txt"] }
|
dev = { file = ["requirements_dev.txt"] }
|
||||||
test = { file = ["requirements_test.txt"] }
|
test = { file = ["requirements_test.txt"] }
|
||||||
displays = { file = ["requirements_optional.txt"] }
|
|
||||||
|
|
||||||
[tool.setuptools.packages.find]
|
[tool.setuptools.packages.find]
|
||||||
include = ["esphome*"]
|
include = ["esphome*"]
|
||||||
|
@ -19,6 +19,7 @@ puremagic==1.28
|
|||||||
ruamel.yaml==0.18.10 # dashboard_import
|
ruamel.yaml==0.18.10 # dashboard_import
|
||||||
esphome-glyphsets==0.2.0
|
esphome-glyphsets==0.2.0
|
||||||
pillow==10.4.0
|
pillow==10.4.0
|
||||||
|
cairosvg==2.7.1
|
||||||
freetype-py==2.5.1
|
freetype-py==2.5.1
|
||||||
|
|
||||||
# esp-idf requires this, but doesn't bundle it by default
|
# esp-idf requires this, but doesn't bundle it by default
|
||||||
|
@ -1 +0,0 @@
|
|||||||
cairosvg==2.7.1
|
|
21
script/setup
21
script/setup
@ -4,25 +4,28 @@
|
|||||||
set -e
|
set -e
|
||||||
|
|
||||||
cd "$(dirname "$0")/.."
|
cd "$(dirname "$0")/.."
|
||||||
location="venv/bin/activate"
|
|
||||||
if [ ! -n "$DEVCONTAINER" ] && [ ! -n "$VIRTUAL_ENV" ] && [ ! "$ESPHOME_NO_VENV" ]; then
|
if [ ! -n "$DEVCONTAINER" ] && [ ! -n "$VIRTUAL_ENV" ] && [ ! "$ESPHOME_NO_VENV" ]; then
|
||||||
|
if [ -x "$(command -v uv)" ]; then
|
||||||
|
uv venv venv
|
||||||
|
else
|
||||||
python3 -m venv venv
|
python3 -m venv venv
|
||||||
if [ -f venv/Scripts/activate ]; then
|
|
||||||
location="venv/Scripts/activate"
|
|
||||||
fi
|
fi
|
||||||
source $location
|
source venv/bin/activate
|
||||||
fi
|
fi
|
||||||
|
|
||||||
pip3 install -r requirements.txt -r requirements_optional.txt -r requirements_test.txt -r requirements_dev.txt
|
if ! [ -x "$(command -v uv)" ]; then
|
||||||
pip3 install setuptools wheel
|
python3 -m pip install uv
|
||||||
pip3 install -e ".[dev,test,displays]" --config-settings editable_mode=compat
|
fi
|
||||||
|
|
||||||
|
uv pip install setuptools wheel
|
||||||
|
uv pip install -e ".[dev,test]" --config-settings editable_mode=compat
|
||||||
|
|
||||||
pre-commit install
|
pre-commit install
|
||||||
|
|
||||||
script/platformio_install_deps.py platformio.ini --libraries --tools --platforms
|
script/platformio_install_deps.py platformio.ini --libraries --tools --platforms
|
||||||
|
|
||||||
mkdir .temp
|
mkdir -p .temp
|
||||||
|
|
||||||
echo
|
echo
|
||||||
echo
|
echo
|
||||||
echo "Virtual environment created. Run 'source $location' to use it."
|
echo "Virtual environment created. Run 'source venv/bin/activate' to use it."
|
||||||
|
@ -15,9 +15,9 @@ echo Installing required packages...
|
|||||||
|
|
||||||
python.exe -m pip install --upgrade pip
|
python.exe -m pip install --upgrade pip
|
||||||
|
|
||||||
pip3 install -r requirements.txt -r requirements_optional.txt -r requirements_test.txt -r requirements_dev.txt
|
pip3 install -r requirements.txt -r requirements_test.txt -r requirements_dev.txt
|
||||||
pip3 install setuptools wheel
|
pip3 install setuptools wheel
|
||||||
pip3 install -e ".[dev,test,displays]" --config-settings editable_mode=compat
|
pip3 install -e ".[dev,test]" --config-settings editable_mode=compat
|
||||||
|
|
||||||
pre-commit install
|
pre-commit install
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user