ARG BUILD_FROM
FROM ${BUILD_FROM}

ENV LANG=C.UTF-8 PYTHONUNBUFFERED=1 PYTHONDONTWRITEBYTECODE=1

# ⚠️ Install the dependencies from APK, not pip. Alpine ships musl, and there are
# no musl wheels for aiohttp on PyPI - pip would compile it from source on the
# client's Raspberry Pi, which needs a toolchain we would then have to ship and
# takes many minutes. apk has prebuilt packages for both.
RUN apk add --no-cache python3 py3-aiohttp py3-paho-mqtt

WORKDIR /opt/goodwe

COPY app/ ./app/
COPY run.sh /run.sh
RUN chmod a+x /run.sh

CMD ["/run.sh"]
