refactor: Improve Dockerfile by adding necessary build tools and cleaning up
38 lines
909 B
Docker
38 lines
909 B
Docker
ARG BUILD_FROM
|
|
FROM $BUILD_FROM
|
|
|
|
# System libraries: BlueZ for BLE/RFCOMM + build tools for numpy & pillow
|
|
RUN apk add --no-cache \
|
|
bluez \
|
|
dbus \
|
|
gcc \
|
|
musl-dev \
|
|
libjpeg-turbo-dev \
|
|
zlib-dev \
|
|
libffi-dev
|
|
|
|
# Install Python runtime dependencies
|
|
RUN pip3 install --no-cache-dir --break-system-packages \
|
|
"bleak>=0.21" \
|
|
"numpy" \
|
|
"pillow" \
|
|
"fastapi>=0.111" \
|
|
"uvicorn[standard]>=0.29" \
|
|
"python-multipart>=0.0.9"
|
|
|
|
# Remove build-only packages to keep the image slim
|
|
RUN apk del gcc musl-dev libffi-dev
|
|
|
|
# Copy the fichero Python package into the container
|
|
WORKDIR /app
|
|
COPY fichero/ /app/fichero/
|
|
|
|
# Make the package importable without installation
|
|
ENV PYTHONPATH=/app
|
|
|
|
# Copy startup script and normalise line endings (Windows CRLF -> LF)
|
|
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"]
|