-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Also build alpine image and ha-addon (#17)
- Loading branch information
1 parent
247e6dc
commit 55bec6d
Showing
4 changed files
with
245 additions
and
71 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -14,8 +14,14 @@ permissions: | |
|
||
jobs: | ||
build: | ||
name: Build | ||
name: Build ${{ matrix.base }} image | ||
runs-on: ubuntu-latest | ||
strategy: | ||
fail-fast: false | ||
matrix: | ||
base: | ||
- debian | ||
- alpine | ||
steps: | ||
- name: Checkout | ||
uses: actions/[email protected] | ||
|
@@ -49,19 +55,34 @@ jobs: | |
fi | ||
echo version="$version" >> $GITHUB_OUTPUT | ||
- name: Build image | ||
id: build | ||
- name: Build base image | ||
uses: docker/[email protected] | ||
env: | ||
DOCKER_BUILD_SUMMARY: false | ||
DOCKER_BUILD_RECORD_UPLOAD: false | ||
with: | ||
context: . | ||
file: ./Dockerfile | ||
context: ${{ matrix.base }} | ||
file: ./${{ matrix.base }}/Dockerfile | ||
platforms: linux/amd64,linux/arm/v7,linux/arm64 | ||
target: final | ||
cache-from: type=registry,ref=ghcr.io/esphome/docker-base:cache | ||
cache-to: ${{ github.event_name == 'release' && 'type=registry,ref=ghcr.io/esphome/docker-base:cache,mode=max' || '' }} | ||
target: docker | ||
cache-from: type=registry,ref=ghcr.io/esphome/docker-base:cache-${{ matrix.base }} | ||
cache-to: ${{ github.event_name == 'release' && format('type=registry,ref=ghcr.io/esphome/docker-base:cache-{0},mode=max', matrix.base) || '' }} | ||
push: ${{ github.event_name != 'pull_request' }} | ||
tags: | | ||
ghcr.io/esphome/docker-base:${{ steps.get_tag.outputs.version }} | ||
ghcr.io/esphome/docker-base:${{ matrix.base }}-${{ steps.get_tag.outputs.version }} | ||
- name: Build ha-addon image | ||
uses: docker/[email protected] | ||
env: | ||
DOCKER_BUILD_SUMMARY: false | ||
DOCKER_BUILD_RECORD_UPLOAD: false | ||
with: | ||
context: ${{ matrix.base }} | ||
file: ./${{ matrix.base }}/Dockerfile | ||
platforms: linux/amd64,linux/arm/v7,linux/arm64 | ||
target: ha-addon | ||
cache-from: type=registry,ref=ghcr.io/esphome/docker-base:cache-${{ matrix.base }} | ||
cache-to: ${{ github.event_name == 'release' && format('type=registry,ref=ghcr.io/esphome/docker-base:cache-{0},mode=max', matrix.base) || '' }} | ||
push: ${{ github.event_name != 'pull_request' }} | ||
tags: | | ||
ghcr.io/esphome/docker-base:${{ matrix.base }}-ha-addon-${{ steps.get_tag.outputs.version }} |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,90 @@ | ||
FROM python:3.12-alpine3.20 AS base | ||
|
||
ENV \ | ||
UV_EXTRA_INDEX_URL=https://wheels.home-assistant.io/musllinux-index/ | ||
|
||
RUN \ | ||
set -x \ | ||
&& apk add --no-cache \ | ||
bash=5.2.26-r0 \ | ||
git=2.45.2-r0 \ | ||
curl=8.10.0-r0 \ | ||
openssh-client=9.7_p1-r4 \ | ||
cairo=1.18.0-r0 \ | ||
libmagic=5.45-r1 \ | ||
patch=2.7.6-r10 | ||
|
||
SHELL ["/bin/bash", "-o", "pipefail", "-c"] | ||
|
||
FROM base AS base-amd64 | ||
FROM base AS base-arm64 | ||
FROM base AS base-armv7 | ||
|
||
ARG TARGETARCH | ||
ARG TARGETVARIANT | ||
|
||
FROM base-${TARGETARCH}${TARGETVARIANT} AS docker | ||
|
||
ENV UV_SYSTEM_PYTHON=true | ||
ENV PIP_ROOT_USER_ACTION=ignore | ||
|
||
RUN pip install uv==0.2.21 | ||
|
||
|
||
FROM docker AS ha-addon | ||
|
||
RUN \ | ||
set -x \ | ||
&& apk add --no-cache \ | ||
nginx=1.26.2-r0 \ | ||
jq=1.7.1-r0 \ | ||
xz=5.6.2-r0 | ||
|
||
ARG \ | ||
BASHIO_VERSION=0.16.2 \ | ||
TEMPIO_VERSION=2021.09.0 \ | ||
S6_OVERLAY_VERSION=3.2.0.0 | ||
|
||
WORKDIR /usr/src | ||
|
||
ARG TARGETARCH | ||
ARG TARGETVARIANT | ||
|
||
RUN \ | ||
set -x \ | ||
&& if [ "${TARGETARCH}${TARGETVARIANT}" = "armv7" ]; then \ | ||
export S6_ARCH="arm"; \ | ||
export TEMPIO_ARCH="armv7"; \ | ||
elif [ "${TARGETARCH}${TARGETVARIANT}" = "amd64" ]; then \ | ||
export S6_ARCH="x86_64"; \ | ||
export TEMPIO_ARCH="amd64"; \ | ||
elif [ "${TARGETARCH}${TARGETVARIANT}" = "arm64" ]; then \ | ||
export S6_ARCH="aarch64"; \ | ||
export TEMPIO_ARCH="aarch64"; \ | ||
fi \ | ||
\ | ||
&& curl -L -f -s "https://github.com/just-containers/s6-overlay/releases/download/v${S6_OVERLAY_VERSION}/s6-overlay-${S6_ARCH}.tar.xz" \ | ||
| tar Jxvf - -C / \ | ||
&& curl -L -f -s "https://github.com/just-containers/s6-overlay/releases/download/v${S6_OVERLAY_VERSION}/s6-overlay-noarch.tar.xz" \ | ||
| tar Jxvf - -C / \ | ||
&& curl -L -f -s "https://github.com/just-containers/s6-overlay/releases/download/v${S6_OVERLAY_VERSION}/s6-overlay-symlinks-arch.tar.xz" \ | ||
| tar Jxvf - -C / \ | ||
&& curl -L -f -s "https://github.com/just-containers/s6-overlay/releases/download/v${S6_OVERLAY_VERSION}/s6-overlay-symlinks-noarch.tar.xz" \ | ||
| tar Jxvf - -C / \ | ||
&& mkdir -p /etc/fix-attrs.d \ | ||
&& mkdir -p /etc/services.d \ | ||
\ | ||
&& curl -L -f -s -o /usr/bin/tempio \ | ||
"https://github.com/home-assistant/tempio/releases/download/${TEMPIO_VERSION}/tempio_${TEMPIO_ARCH}" \ | ||
&& chmod a+x /usr/bin/tempio \ | ||
\ | ||
&& mkdir -p /usr/src/bashio \ | ||
&& curl -L -f -s "https://github.com/hassio-addons/bashio/archive/v${BASHIO_VERSION}.tar.gz" \ | ||
| tar -xzf - --strip 1 -C /usr/src/bashio \ | ||
&& mv /usr/src/bashio/lib /usr/lib/bashio \ | ||
&& ln -s /usr/lib/bashio/bashio /usr/bin/bashio \ | ||
\ | ||
&& rm -rf /usr/src/* | ||
|
||
WORKDIR /root | ||
ENTRYPOINT ["/init"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,125 @@ | ||
FROM python:3.12-slim-bookworm AS base | ||
|
||
SHELL ["/bin/bash", "-o", "pipefail", "-c"] | ||
|
||
RUN \ | ||
set -x \ | ||
&& apt-get update \ | ||
&& apt-get install -y --no-install-recommends \ | ||
iputils-ping=3:20221126-1 \ | ||
git=1:2.39.2-1.1 \ | ||
curl=7.88.1-10+deb12u7 \ | ||
openssh-client=1:9.2p1-2+deb12u3 \ | ||
libcairo2=1.16.0-7 \ | ||
libmagic1=1:5.44-3 \ | ||
patch=2.7.6-7 \ | ||
&& apt-get purge -y --auto-remove \ | ||
&& rm -rf \ | ||
/tmp/* \ | ||
/var/{cache,log}/* \ | ||
/var/lib/apt/lists/* \ | ||
/usr/src/* | ||
|
||
FROM base AS base-amd64 | ||
FROM base AS base-arm64 | ||
FROM base AS base-armv7 | ||
|
||
ENV UV_EXTRA_INDEX_URL=https://www.piwheels.org/simple | ||
|
||
RUN \ | ||
set -x \ | ||
&& apt-get update \ | ||
&& apt-get install -y --no-install-recommends \ | ||
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+deb12u3 \ | ||
libssl-dev=3.0.14-1~deb12u2 \ | ||
libffi-dev=3.4.4-1 \ | ||
libopenjp2-7=2.5.0-2 \ | ||
libtiff6=4.5.0-6+deb12u1 \ | ||
cargo=0.66.0+ds1-1 \ | ||
pkg-config=1.8.1-1 \ | ||
gcc-arm-linux-gnueabihf=4:12.2.0-3 \ | ||
&& rm -rf \ | ||
/tmp/* \ | ||
/var/{cache,log}/* \ | ||
/var/lib/apt/lists/* \ | ||
/usr/src/* | ||
|
||
RUN ln -s /lib/arm-linux-gnueabihf/ld-linux-armhf.so.3 /lib/ld-linux.so.3 | ||
|
||
ARG TARGETARCH | ||
ARG TARGETVARIANT | ||
|
||
FROM base-${TARGETARCH}${TARGETVARIANT} AS docker | ||
|
||
ENV UV_SYSTEM_PYTHON=true | ||
ENV PIP_ROOT_USER_ACTION=ignore | ||
|
||
RUN pip install uv==0.2.21 | ||
|
||
FROM docker AS ha-addon | ||
|
||
RUN \ | ||
set -x \ | ||
&& apt-get update \ | ||
&& apt-get install -y --no-install-recommends \ | ||
nginx-light=1.22.1-9 \ | ||
jq=1.6-2.1 \ | ||
xz-utils=5.4.1-0.2 \ | ||
&& rm -rf \ | ||
/tmp/* \ | ||
/var/{cache,log}/* \ | ||
/var/lib/apt/lists/* \ | ||
/usr/src/* | ||
|
||
ARG \ | ||
BASHIO_VERSION=0.16.2 \ | ||
TEMPIO_VERSION=2021.09.0 \ | ||
S6_OVERLAY_VERSION=3.2.0.0 | ||
|
||
WORKDIR /usr/src | ||
|
||
ARG TARGETARCH | ||
ARG TARGETVARIANT | ||
|
||
RUN \ | ||
set -x \ | ||
&& if [ "${TARGETARCH}${TARGETVARIANT}" = "armv7" ]; then \ | ||
export S6_ARCH="arm"; \ | ||
export TEMPIO_ARCH="armv7"; \ | ||
elif [ "${TARGETARCH}${TARGETVARIANT}" = "amd64" ]; then \ | ||
export S6_ARCH="x86_64"; \ | ||
export TEMPIO_ARCH="amd64"; \ | ||
elif [ "${TARGETARCH}${TARGETVARIANT}" = "arm64" ]; then \ | ||
export S6_ARCH="aarch64"; \ | ||
export TEMPIO_ARCH="aarch64"; \ | ||
fi \ | ||
\ | ||
&& curl -L -f -s "https://github.com/just-containers/s6-overlay/releases/download/v${S6_OVERLAY_VERSION}/s6-overlay-${S6_ARCH}.tar.xz" \ | ||
| tar Jxvf - -C / \ | ||
&& curl -L -f -s "https://github.com/just-containers/s6-overlay/releases/download/v${S6_OVERLAY_VERSION}/s6-overlay-noarch.tar.xz" \ | ||
| tar Jxvf - -C / \ | ||
&& curl -L -f -s "https://github.com/just-containers/s6-overlay/releases/download/v${S6_OVERLAY_VERSION}/s6-overlay-symlinks-arch.tar.xz" \ | ||
| tar Jxvf - -C / \ | ||
&& curl -L -f -s "https://github.com/just-containers/s6-overlay/releases/download/v${S6_OVERLAY_VERSION}/s6-overlay-symlinks-noarch.tar.xz" \ | ||
| tar Jxvf - -C / \ | ||
&& mkdir -p /etc/fix-attrs.d \ | ||
&& mkdir -p /etc/services.d \ | ||
\ | ||
&& curl -L -f -s -o /usr/bin/tempio \ | ||
"https://github.com/home-assistant/tempio/releases/download/${TEMPIO_VERSION}/tempio_${TEMPIO_ARCH}" \ | ||
&& chmod a+x /usr/bin/tempio \ | ||
\ | ||
&& mkdir -p /usr/src/bashio \ | ||
&& curl -L -f -s "https://github.com/hassio-addons/bashio/archive/v${BASHIO_VERSION}.tar.gz" \ | ||
| tar -xzf - --strip 1 -C /usr/src/bashio \ | ||
&& mv /usr/src/bashio/lib /usr/lib/bashio \ | ||
&& ln -s /usr/lib/bashio/bashio /usr/bin/bashio \ | ||
\ | ||
&& rm -rf /usr/src/* | ||
|
||
WORKDIR /root | ||
ENTRYPOINT ["/init"] |