make docker image from 1GB to around 100MB

This commit is contained in:
2024-06-27 00:42:25 +02:00
parent 72762340ce
commit 9581a3ce2c
16 changed files with 2693 additions and 357 deletions

View File

@@ -1,27 +1,35 @@
FROM python:3.12-alpine3.20 AS build_bluepy
RUN apk add \
bluez \
make \
git \glib-dev \
gcc \
build-base \
freetype-dev \
libpng-dev \
openblas-dev
RUN git clone https://github.com/IanHarvey/bluepy.git && \
cd bluepy && \
python3.12 setup.py build && \
python3.12 setup.py install
FROM python:3.12-alpine3.20
WORKDIR = /src
COPY python/src/ .
COPY python/requierements.txt .
COPY python/docker_entrypoint.sh /
RUN mkdir data
VOLUME data
# RUN apt-get update && \
# apt-get install -y bluez sudo
RUN apk add sudo bluez
# Copy bluepy from the bluepy build stage
COPY --from=build_bluepy /usr/local/lib/python3.12/site-packages /usr/local/lib/python3.12/site-packages
COPY --from=build_bluepy /usr/local/bin /usr/local/bin
RUN apk add --no-cache \
sudo \
make \
bluez \
bluez-deprecated \
alsa-utils \
alsa-utils-doc \
alsa-lib \
alsaconf
RUN pip3.12 install -r requierements.txt && rm -f requierements.txt
RUN pip3.12 install -r requierements.txt && rm requierements.txt
ENTRYPOINT sh /docker_entrypoint.sh