Signed-off-by: Peter Siegmund <mars3142@noreply.mars3142.dev>
This commit is contained in:
32
Dockerfile
32
Dockerfile
@@ -1,11 +1,33 @@
|
||||
# Dockerfile für bambu.py
|
||||
FROM python:3.11-slim
|
||||
## Dockerfile for bambu.py
|
||||
FROM python:3.11.7-alpine
|
||||
|
||||
LABEL maintainer="Peter Siegmund <mars3142@noreply.mars3142.dev>"
|
||||
LABEL org.opencontainers.image.source="https://git.mars3142.dev/mars3142/bambu_mqtt"
|
||||
LABEL org.opencontainers.image.description="MQTT-Bridge für BambuLab Drucker"
|
||||
LABEL org.opencontainers.image.version="0.1.0"
|
||||
|
||||
WORKDIR /app
|
||||
|
||||
## Copy only requirements.txt first for better caching
|
||||
COPY requirements.txt /app/requirements.txt
|
||||
RUN apk add --no-cache build-base libffi-dev openssl-dev \
|
||||
&& python -m venv /app/.venv \
|
||||
&& /app/.venv/bin/pip install --no-cache-dir -r /app/requirements.txt \
|
||||
&& apk del build-base libffi-dev openssl-dev
|
||||
|
||||
## Now copy the actual code
|
||||
COPY bambu.py /app/bambu.py
|
||||
|
||||
# Optional: requirements.txt falls weitere Pakete benötigt werden
|
||||
RUN pip install --no-cache-dir paho-mqtt dotenv
|
||||
## Create non-root user
|
||||
RUN adduser -D -h /app appuser \
|
||||
&& chown -R appuser:appuser /app
|
||||
USER appuser
|
||||
|
||||
CMD ["python", "-u", "bambu.py"]
|
||||
ENV PATH="/app/.venv/bin:$PATH"
|
||||
|
||||
## Healthcheck: checks if the process is running (simple example)
|
||||
HEALTHCHECK --interval=30s --timeout=5s --start-period=10s --retries=3 \
|
||||
CMD pgrep -f "python -u bambu.py" || exit 1
|
||||
|
||||
## ENTRYPOINT for better extensibility
|
||||
ENTRYPOINT ["python", "-u", "bambu.py"]
|
||||
|
||||
Reference in New Issue
Block a user