38 lines
1002 B
Docker
38 lines
1002 B
Docker
ARG BUILD_FROM
|
|
FROM $BUILD_FROM
|
|
|
|
# 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 \
|
|
python3 \
|
|
py3-pip \
|
|
dbus-dev \
|
|
build-base \
|
|
bluez
|
|
|
|
# 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"
|
|
|
|
# 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 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"]
|