This commit is contained in:
paul2212
2026-03-16 13:48:12 +01:00
parent 66c3f06b48
commit fef3d18d3f
7 changed files with 51 additions and 13 deletions

View File

@@ -1,8 +1,9 @@
ARG BUILD_FROM
FROM $BUILD_FROM
# Install build tools for Python packages that need compilation (numpy, pillow)
# and dbus-dev for Bleak to communicate with the host's BlueZ via D-Bus.
# Install system dependencies.
# build-base is for compiling Python packages (numpy, pillow).
# dbus-dev is for Bleak to communicate with the host's BlueZ.
# Do NOT install bluez here - we use the host BlueZ, not our own.
RUN apk add --no-cache \
bash \
@@ -11,17 +12,25 @@ RUN apk add --no-cache \
dbus-dev \
build-base
# Copy the entire project into the container.
# This requires the Docker build context to be the root of the repository.
WORKDIR /app
COPY . .
# Install Python dependencies from pip.
# We cannot use `pip install .` from pyproject.toml as it's outside the build context.
RUN pip3 install --no-cache-dir --break-system-packages \
"bleak" \
"numpy" \
"Pillow" \
"fastapi" \
"uvicorn[standard]" \
"python-multipart>=0.0.9"
# Install the fichero-printer package and all its dependencies from pyproject.toml.
# This makes the `fichero` and `fichero-server` commands available system-wide.
RUN pip3 install --no-cache-dir --break-system-packages .
# Copy the application code into the container.
WORKDIR /app
COPY fichero/ /app/fichero/
# Make the 'fichero' package importable.
ENV PYTHONPATH=/app
# Copy startup script and normalise line endings (Windows CRLF -> LF)
COPY fichero_printer/run.sh /usr/bin/run.sh
COPY run.sh /usr/bin/run.sh
RUN sed -i 's/\r//' /usr/bin/run.sh && chmod +x /usr/bin/run.sh
CMD ["/usr/bin/run.sh"]