-
Notifications
You must be signed in to change notification settings - Fork 1
/
Dockerfile
74 lines (68 loc) · 1.91 KB
/
Dockerfile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
# syntax=docker/dockerfile:1
FROM ghcr.io/imagegenius/baseimage-alpine:3.18
# set version label
ARG BUILD_DATE
ARG VERSION
ARG ESPHOME_VERSION
LABEL build_version="ImageGenius Version:- ${VERSION} Build-date:- ${BUILD_DATE}"
LABEL maintainer="hydazz"
# environment settings
ENV PLATFORMIO_GLOBALLIB_DIR=/piolibs
RUN \
echo "**** install build packages ****" && \
apk add --no-cache --virtual=build-dependencies \
cargo \
g++ \
gcc \
libffi-dev \
libc-dev \
python3-dev && \
echo "**** install runtime packages ****" && \
apk add --no-cache \
gcompat \
iputils \
openssl-dev \
py3-pip \
python3 && \
pip install --break-system-packages --no-cache-dir --upgrade \
reedsolo \
setuptools \
wheel && \
pip install --break-system-packages --no-binary :all: \
protobuf && \
echo "**** install esphome ****" && \
mkdir -p \
/tmp/esphome \
/piolibs && \
if [ -z ${ESPHOME_VERSION} ]; then \
ESPHOME_VERSION=$(curl -sL https://api.github.com/repos/esphome/esphome/releases/latest | \
jq -r '.tag_name'); \
fi && \
curl -o \
/tmp/esphome.tar.gz -L \
"https://github.com/esphome/esphome/archive/${ESPHOME_VERSION}.tar.gz" && \
tar xf \
/tmp/esphome.tar.gz -C \
/tmp/esphome --strip-components=1 && \
cd /tmp/esphome && \
pip install --break-system-packages --no-cache-dir \
-r requirements.txt \
-r requirements_optional.txt && \
python3 script/platformio_install_deps.py platformio.ini --libraries && \
pip install --break-system-packages --no-cache-dir \
esphome=="${ESPHOME_VERSION}" && \
echo "**** cleanup ****" && \
apk del --purge \
build-dependencies && \
for cleanfiles in *.pyc *.pyo; do \
find /usr/lib/python3.* -iname "${cleanfiles}" -delete; \
done && \
rm -rf \
/tmp/* \
/root/.cache \
/root/.cargo
# copy local files
COPY root/ /
# ports and volumes
EXPOSE 6052
VOLUME /config