Refactored and updated dsmr_parser
This commit is contained in:
52
Dockerfile
52
Dockerfile
@@ -1,31 +1,31 @@
|
||||
FROM python:3.12 AS build
|
||||
RUN pip install poetry
|
||||
|
||||
# For more information, please refer to https://aka.ms/vscode-docker-python
|
||||
FROM python:3.11-slim as base
|
||||
|
||||
FROM base as builder
|
||||
RUN apt-get update \
|
||||
&& apt-get install gcc=4:10.* git=1:2.* -y \
|
||||
&& apt-get clean
|
||||
COPY requirements.txt /app/requirements.txt
|
||||
WORKDIR /app
|
||||
ENV PATH=/root/.local/bin:$PATH
|
||||
RUN pip install --user -r requirements.txt
|
||||
COPY . /app
|
||||
|
||||
FROM base as app
|
||||
COPY . /app
|
||||
COPY --from=builder /root/.local /root/.local
|
||||
|
||||
# # Keeps Python from generating .pyc files in the container
|
||||
# ENV PYTHONDONTWRITEBYTECODE 1
|
||||
|
||||
# Turns off buffering for easier container logging
|
||||
ENV PYTHONUNBUFFERED 1
|
||||
|
||||
# Access local binaries
|
||||
ENV PATH=/root/.local/bin:$PATH
|
||||
ENV POETRY_NO_INTERACTION=1 \
|
||||
POETRY_VIRTUALENVS_IN_PROJECT=1 \
|
||||
POETRY_VIRTUALENVS_CREATE=1 \
|
||||
POETRY_CACHE_DIR=/tmp/poetry_cache
|
||||
|
||||
WORKDIR /app
|
||||
|
||||
COPY pyproject.toml poetry.lock ./
|
||||
COPY packages ./packages
|
||||
|
||||
RUN apt update && apt install -y build-essential
|
||||
RUN if [ $(dpkg --print-architecture) = "armhf" ]; then \
|
||||
printf "[global]\nextra-index-url=https://www.piwheels.org/simple\n" > /etc/pip.conf ; \
|
||||
fi
|
||||
|
||||
RUN --mount=type=cache,target=$POETRY_CACHE_DIR poetry -v install --without dev --no-root
|
||||
|
||||
FROM python:3.12-slim AS final
|
||||
WORKDIR /app
|
||||
ENV VIRTUAL_ENV=/app/.venv \
|
||||
PATH="/app/.venv/bin:$PATH" \
|
||||
PYTHONUNBUFFERED=1
|
||||
|
||||
COPY --from=build ${VIRTUAL_ENV} ${VIRTUAL_ENV}
|
||||
COPY dsmr2mqtt ./dsmr2mqtt
|
||||
|
||||
# During debugging, this entry point will be overridden. For more information, refer to https://aka.ms/vscode-docker-python-debug
|
||||
CMD ["python", "app.py"]
|
||||
CMD ["python", "-m", "dsmr2mqtt"]
|
||||
|
||||
Reference in New Issue
Block a user