mirror of
https://github.com/dimalo/klipper-web-control-docker.git
synced 2026-05-07 05:07:18 +02:00
fix missing gcc in image to build wheels
- use build stage to compile wheels, then just install in target image
This commit is contained in:
@@ -9,6 +9,9 @@ ARG HOME=/home/${USER}
|
||||
ARG KLIPPER_VENV_DIR=${HOME}/klippy-env
|
||||
ARG MOONRAKER_VENV_DIR=${HOME}/moonraker-env
|
||||
|
||||
ENV WHEELS=/wheels
|
||||
ENV PYTHONUNBUFFERED=1
|
||||
|
||||
RUN useradd -d ${HOME} -ms /bin/bash ${USER}
|
||||
RUN apt-get update && \
|
||||
apt-get install -y \
|
||||
@@ -30,7 +33,8 @@ RUN apt-get update && \
|
||||
|
||||
RUN sed -i -e 's/# en_GB.UTF-8 UTF-8/en_GB.UTF-8 UTF-8/' /etc/locale.gen
|
||||
RUN locale-gen
|
||||
RUN python -m pip install pip -U
|
||||
RUN python -m pip install -U pip wheel && \
|
||||
pip wheel --no-cache-dir -w ${WHEELS} supervisord-dependent-startup gpiod numpy matplotlib
|
||||
|
||||
ENV LC_ALL en_GB.UTF-8
|
||||
ENV LANG en_GB.UTF-8
|
||||
@@ -42,10 +46,10 @@ WORKDIR ${HOME}
|
||||
### Klipper setup ###
|
||||
RUN git clone --single-branch --branch ${KLIPPER_BRANCH} https://github.com/Klipper3d/klipper.git klipper
|
||||
RUN [ ! -d ${KLIPPER_VENV_DIR} ] && python3 -m venv ${KLIPPER_VENV_DIR}
|
||||
RUN ${KLIPPER_VENV_DIR}/bin/pip install wheel numpy
|
||||
|
||||
WORKDIR ${HOME}/klipper
|
||||
RUN ${KLIPPER_VENV_DIR}/bin/pip install -r scripts/klippy-requirements.txt
|
||||
RUN ${KLIPPER_VENV_DIR}/bin/pip install wheel && \
|
||||
${KLIPPER_VENV_DIR}/bin/pip install --no-cache-dir -f ${WHEELS} -r scripts/klippy-requirements.txt
|
||||
RUN ${KLIPPER_VENV_DIR}/bin/python klippy/chelper/__init__.py
|
||||
RUN ${KLIPPER_VENV_DIR}/bin/python -m compileall klippy
|
||||
|
||||
@@ -56,10 +60,11 @@ WORKDIR ${HOME}
|
||||
# Install moonraker
|
||||
RUN git clone --single-branch --branch ${MOONRAKER_BRANCH} https://github.com/Arksine/moonraker.git moonraker
|
||||
RUN [ ! -d ${MOONRAKER_VENV_DIR} ] && python3 -m venv ${MOONRAKER_VENV_DIR}
|
||||
RUN ${MOONRAKER_VENV_DIR}/bin/pip install wheel gpiod
|
||||
|
||||
WORKDIR ${HOME}/moonraker
|
||||
RUN ${MOONRAKER_VENV_DIR}/bin/pip install -r scripts/moonraker-requirements.txt
|
||||
RUN ${MOONRAKER_VENV_DIR}/bin/pip install wheel && \
|
||||
${MOONRAKER_VENV_DIR}/bin/pip install --no-cache-dir -f ${WHEELS} -r scripts/moonraker-requirements.txt
|
||||
RUN ${MOONRAKER_VENV_DIR}/bin/python -m compileall moonraker
|
||||
|
||||
FROM python:3.10-slim-bullseye as image
|
||||
|
||||
@@ -99,17 +104,24 @@ ENV CONFIG_DIR=${HOME}/.config
|
||||
ENV KLIPPER_VENV_DIR=${HOME}/klippy-env
|
||||
ENV MOONRAKER_VENV_DIR=${HOME}/moonraker-env
|
||||
|
||||
ENV WHEELS=/wheels
|
||||
ENV PYTHONUNBUFFERED=1
|
||||
|
||||
ARG DEVICE_GROUP=device
|
||||
ARG DEVICE_GID=987
|
||||
|
||||
|
||||
RUN useradd --user-group --no-log-init --shell /bin/false -m -d ${HOME} ${USER} && \
|
||||
groupadd -g ${DEVICE_GID} ${DEVICE_GROUP} && \
|
||||
usermod -a -G ${DEVICE_GROUP} ${USER} && \
|
||||
usermod -a -G tty ${USER} && \
|
||||
usermod -a -G dialout ${USER} && \
|
||||
mkdir -p /var/log/supervisor && \
|
||||
mkdir -p /var/log/klipper && chown ${USER}:${USER} /var/log/klipper ${HOME} && \
|
||||
pip install --no-cache supervisord-dependent-startup gpiod numpy matplotlib && \
|
||||
mkdir -p /var/log/supervisor ${HOME}/.cache/pip && \
|
||||
mkdir -p /var/log/klipper && chown -R ${USER}:${USER} /var/log/klipper ${HOME}
|
||||
|
||||
COPY --chown=${USER}:${USER} --from=builder ${WHEELS} ${WHEELS}
|
||||
|
||||
RUN pip install --no-index -f ${WHEELS} supervisord-dependent-startup gpiod numpy matplotlib && \
|
||||
mkdir -p /usr/lib/python3 && \
|
||||
ln -s /usr/local/lib/python3.10/site-packages /usr/lib/python3/dist-packages
|
||||
|
||||
|
||||
Reference in New Issue
Block a user