diff --git a/docker/octoprint/Dockerfile b/docker/octoprint/Dockerfile index c8da839..aa3f01d 100644 --- a/docker/octoprint/Dockerfile +++ b/docker/octoprint/Dockerfile @@ -1,5 +1,33 @@ -ARG VERSION=minimal -FROM octoprint/octoprint:${VERSION} +## Install OctoPrint and Plugins in venv +FROM python:3 as build -COPY plugins.txt /tmp/plugins.txt -RUN pip install -r /tmp/plugins.txt +ARG VERSION=1.7.2 + +WORKDIR /opt +COPY plugins.txt plugins.txt +RUN python -m venv venv \ + && venv/bin/pip install OctoPrint==${VERSION} \ + && venv/bin/pip install -r plugins.txt + +## Runtime Image +FROM python:3-slim as run + +WORKDIR /opt +COPY --from=build /opt/venv venv +COPY apt.txt apt.txt + +RUN apt update \ + && apt install -y $(grep -vE "^\s*#" apt.txt | tr "\n" " ") \ + && apt clean + +RUN mkdir run cfg +RUN groupadd octoprint --gid 1000 \ + && useradd octoprint --uid 1000 --gid octoprint \ + && usermod octoprint --append --groups dialout \ + && chown -R octoprint:octoprint /opt/* + + USER octoprint + EXPOSE 5000 + VOLUME ["/opt/run", "/opt/cfg"] + ENTRYPOINT ["/opt/venv/bin/octoprint", "serve"] + CMD ["-b", "/opt/cfg"] \ No newline at end of file diff --git a/docker/octoprint/apt.txt b/docker/octoprint/apt.txt new file mode 100644 index 0000000..0a42287 --- /dev/null +++ b/docker/octoprint/apt.txt @@ -0,0 +1,5 @@ +# FilamentManager +psycopg2 + +# PrusaSlicerThumbnails +libjpeg62-turbo \ No newline at end of file diff --git a/scripts/build-images.sh b/scripts/build-images.sh index 276cb3e..a3031f4 100755 --- a/scripts/build-images.sh +++ b/scripts/build-images.sh @@ -1,5 +1,8 @@ #!/bin/bash +## https://www.stereolabs.com/docs/docker/building-arm-container-on-x86/ +## docker run --rm --privileged multiarch/qemu-user-static --reset -p yes + set -e registry=${1}