Dockerfile 776 B

123456789101112131415161718192021
  1. ##Miflora-mqtt-daemon Docker image
  2. #Builds compact image to run as an alternative to installing the modules/service.
  3. # The build image
  4. FROM python:3.10.7-slim as builder
  5. LABEL stage=builder
  6. RUN apt-get update && apt-get install bluez gcc libglib2.0-dev build-essential -y && apt-get clean
  7. COPY requirements.txt /app/requirements.txt
  8. WORKDIR /app/
  9. RUN pip install --user -r requirements.txt
  10. COPY . /app
  11. # The production image
  12. FROM python:3.10.7-slim as app
  13. RUN apt-get update && apt-get install bluetooth bluez -y && apt-get clean
  14. COPY --from=builder /root/.local /root/.local
  15. COPY --from=builder /app/miflora-mqtt-daemon.py /app/miflora-mqtt-daemon.py
  16. WORKDIR /app/
  17. ENV PATH=/root/.local/bin:$PATH
  18. CMD [ "python3", "./miflora-mqtt-daemon.py", "--config_dir", "/config" ]