From dcadcdf0567991d8b8ee08f2acd6a393eafc1593 Mon Sep 17 00:00:00 2001 From: Otto Winter Date: Wed, 15 Jul 2020 15:03:15 +0200 Subject: [PATCH] Use more layer caching for esphome/esphome Dockerfile (#1150) --- .github/workflows/release-dev.yml | 2 +- .github/workflows/release.yml | 2 +- docker/Dockerfile | 15 ++++++++++++--- docker/Dockerfile.dev | 2 +- docker/Dockerfile.lint | 2 +- 5 files changed, 16 insertions(+), 7 deletions(-) diff --git a/.github/workflows/release-dev.yml b/.github/workflows/release-dev.yml index 3eb6884ee0..59beeea212 100644 --- a/.github/workflows/release-dev.yml +++ b/.github/workflows/release-dev.yml @@ -187,7 +187,7 @@ jobs: echo "::set-env name=TAG::${TAG}" - name: Set up env variables run: | - base_version="2.3.1" + base_version="2.3.3" if [[ "${{ matrix.build_type }}" == "hassio" ]]; then build_from="esphome/esphome-hassio-base-${{ matrix.arch }}:${base_version}" diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 43e0d86365..84610156a1 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -206,7 +206,7 @@ jobs: echo "::set-env name=TAG::${TAG}" - name: Set up env variables run: | - base_version="2.3.1" + base_version="2.3.3" if [[ "${{ matrix.build_type }}" == "hassio" ]]; then build_from="esphome/esphome-hassio-base-${{ matrix.arch }}:${base_version}" diff --git a/docker/Dockerfile b/docker/Dockerfile index 16b546d0dd..d0b4f2ffa1 100644 --- a/docker/Dockerfile +++ b/docker/Dockerfile @@ -1,12 +1,21 @@ -ARG BUILD_FROM=esphome/esphome-base-amd64:2.3.1 +ARG BUILD_FROM=esphome/esphome-base-amd64:2.3.3 FROM ${BUILD_FROM} +# First install requirements to leverage caching when requirements don't change +COPY requirements.txt / +RUN pip3 install --no-cache-dir -r /requirements.txt + +# Then copy esphome and install COPY . . RUN pip3 install --no-cache-dir -e . -ENV USERNAME="" -ENV PASSWORD="" +# Settings for dashboard +ENV USERNAME="" PASSWORD="" +# The directory the user should mount their configuration files to WORKDIR /config +# Set entrypoint to esphome so that the user doesn't have to type 'esphome' +# in every docker command twice ENTRYPOINT ["esphome"] +# When no arguments given, start the dashboard in the workdir CMD ["/config", "dashboard"] diff --git a/docker/Dockerfile.dev b/docker/Dockerfile.dev index 0a72361a28..b6a0f8f90b 100644 --- a/docker/Dockerfile.dev +++ b/docker/Dockerfile.dev @@ -1,4 +1,4 @@ -FROM esphome/esphome-base-amd64:2.3.1 +FROM esphome/esphome-base-amd64:2.3.3 COPY . . diff --git a/docker/Dockerfile.lint b/docker/Dockerfile.lint index a1839a82c0..bc7caa7e97 100644 --- a/docker/Dockerfile.lint +++ b/docker/Dockerfile.lint @@ -1,4 +1,4 @@ -FROM esphome/esphome-lint-base:2.3.1 +FROM esphome/esphome-lint-base:2.3.3 COPY requirements.txt requirements_test.txt / RUN pip3 install --no-cache-dir -r /requirements.txt -r /requirements_test.txt