From 080e0845373afc8b012035975ddbd47db12bc3db Mon Sep 17 00:00:00 2001 From: Brian Vanderbusch Date: Mon, 7 Sep 2020 13:10:45 -0500 Subject: [PATCH 1/7] add octoprint fixes #73 fixes #71 --- Dockerfile | 20 ++++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) diff --git a/Dockerfile b/Dockerfile index 8817545..e40feb4 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,4 +1,4 @@ -ARG OCTOPRINT_BASE_IMAGE +ARG PYTHON_BASE_IMAGE=3.8-slim-buster FROM ubuntu AS s6build ARG S6_RELEASE @@ -18,7 +18,10 @@ RUN ARCH= && dpkgArch="$(dpkg --print-architecture)" \ && curl -fsSLO "https://github.com/just-containers/s6-overlay/releases/download/$S6_VERSION/s6-overlay-$ARCH.tar.gz" -FROM octoprint/octoprint:${OCTOPRINT_BASE_IMAGE} AS build +FROM python:${PYTHON_BASE_IMAGE} AS build + +ARG tag +ENV tag ${tag:-master} USER root @@ -46,6 +49,17 @@ COPY --from=s6build /tmp /tmp RUN s6tar=$(find /tmp -name "s6-overlay-*.tar.gz") \ && tar xzf $s6tar -C / +# Install octoprint +RUN curl -fsSLO --compressed --retry 3 --retry-delay 10 \ + https://github.com/OctoPrint/OctoPrint/archive/${tag}.tar.gz \ + && mkdir -p /opt/octoprint \ + && tar xzf ${tag}.tar.gz --strip-components 1 -C /opt/octoprint --no-same-owner + +WORKDIR /opt/octoprint +RUN pip install -r requirements.txt +RUN python setup.py install +RUN ls -s ~/.octoprint /octoprint + # Install mjpg-streamer RUN curl -fsSLO --compressed --retry 3 --retry-delay 10 \ https://github.com/jacksonliam/mjpg-streamer/archive/master.tar.gz \ @@ -60,6 +74,8 @@ RUN make install COPY root / ENV CAMERA_DEV /dev/video0 ENV MJPEG_STREAMER_INPUT -y -n -r 640x480 +ENV PIP_USER true +ENV PYTHONUSERBASE /octoprint/plugins # port to access haproxy frontend EXPOSE 80 From a6c34634ba61ce6fd941f4e71ee2c22de338a2e3 Mon Sep 17 00:00:00 2001 From: Brian Vanderbusch Date: Mon, 7 Sep 2020 14:00:22 -0500 Subject: [PATCH 2/7] fix symlink command typo --- Dockerfile | 6 +++--- Makefile | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/Dockerfile b/Dockerfile index e40feb4..a09abaa 100644 --- a/Dockerfile +++ b/Dockerfile @@ -23,8 +23,6 @@ FROM python:${PYTHON_BASE_IMAGE} AS build ARG tag ENV tag ${tag:-master} -USER root - RUN apt-get update && apt-get install -y \ avrdude \ build-essential \ @@ -58,7 +56,7 @@ RUN curl -fsSLO --compressed --retry 3 --retry-delay 10 \ WORKDIR /opt/octoprint RUN pip install -r requirements.txt RUN python setup.py install -RUN ls -s ~/.octoprint /octoprint +RUN ln -s ~/.octoprint /octoprint # Install mjpg-streamer RUN curl -fsSLO --compressed --retry 3 --retry-delay 10 \ @@ -80,5 +78,7 @@ ENV PYTHONUSERBASE /octoprint/plugins # port to access haproxy frontend EXPOSE 80 +VOLUME /octoprint + ENTRYPOINT ["/init"] CMD ["octoprint", "serve", "--iknowwhatimdoing", "--host", "0.0.0.0"] diff --git a/Makefile b/Makefile index 4c43e15..4362e32 100644 --- a/Makefile +++ b/Makefile @@ -36,7 +36,7 @@ buildx-test: --cache-to ${CACHE} \ --build-arg PYTHON_BASE_IMAGE=$(PYTHON_BASE_IMAGE) \ --build-arg tag=${OCTOPRINT_VERSION} \ - --progress plain -t ${IMG}:ci . + --progress tty -t ${IMG}:ci . buildx-push: @echo '[buildx]: building and pushing images: ${IMG}:${IMG_TAG} for all supported architectures' From f0ec19584ee9b8ce45e7c4242db78de5fd937cd4 Mon Sep 17 00:00:00 2001 From: Brian Vanderbusch Date: Mon, 7 Sep 2020 14:17:16 -0500 Subject: [PATCH 3/7] fix build-args in workflows --- .github/workflows/build.yml | 2 +- .github/workflows/octoprint-release.yml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index c46617a..55c6591 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -39,5 +39,5 @@ jobs: --platform linux/arm64,linux/amd64,linux/arm/v7 \ --cache-from octoprint/octoprint:cache \ --cache-to octoprint/octoprint:cache \ - --build-arg OCTOPRINT_BASE_IMAGE=${{ steps.get-octoprint-release.outputs.release }} \ + --build-arg tag=${{ steps.get-octoprint-release.outputs.release }} \ --progress plain -t octoprint/octoprint:ci -f Dockerfile . diff --git a/.github/workflows/octoprint-release.yml b/.github/workflows/octoprint-release.yml index d754b43..3009d04 100644 --- a/.github/workflows/octoprint-release.yml +++ b/.github/workflows/octoprint-release.yml @@ -74,6 +74,6 @@ jobs: --platform linux/arm64,linux/amd64,linux/arm/v7 \ --cache-from octoprint/octoprint:cache \ --cache-to octoprint/octoprint:cache \ - --build-arg OCTOPRINT_BASE_IMAGE=${{ steps.get-octoprint-release.outputs.release }} \ + --build-arg tag=${{ env.tag_name }} \ --progress plain -t octoprint/octoprint:${{ steps.tagging.outputs.tag }} -f Dockerfile . From 71759546514f8af1bc20616a43626305182d7d20 Mon Sep 17 00:00:00 2001 From: Brian Vanderbusch Date: Tue, 8 Sep 2020 12:01:35 -0500 Subject: [PATCH 4/7] fix table formatting --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index f79fee6..e1d19d6 100644 --- a/README.md +++ b/README.md @@ -27,7 +27,7 @@ launch of OctoPrint using docker. Use the following values in the webcam & timelapse settings screen of the initial setup: | Setting | Value | -|=========|=======| +| ------- | ----- | | Stream URL | `/webcam/?action=stream` | | Snapshot URL | `http://localhost:8080/?action=snapshot` | | Path to FFMPEG | `/usr/bin/ffmpeg` | @@ -39,7 +39,7 @@ Listed below are the options and their defaults. These are implicit in example [ and if you wish to change them, refer to the docker-compose docs on setting environment variables. | variable | default | -|==========|=========| +| -------- | ------- | | `CAMERA_DEV` | `/dev/video0` (see [note](#devices_note)) | | `CAMERA_DEV` | `MJPEG_STREAMER_INPUT -y -n -r 640x48` | From 782658bc97d6afbe2371bdbb04a8689fca424812 Mon Sep 17 00:00:00 2001 From: Brian Vanderbusch Date: Tue, 8 Sep 2020 12:04:40 -0500 Subject: [PATCH 5/7] add ffmpeg to build stage --- Dockerfile | 1 + 1 file changed, 1 insertion(+) diff --git a/Dockerfile b/Dockerfile index a09abaa..765d1c5 100644 --- a/Dockerfile +++ b/Dockerfile @@ -29,6 +29,7 @@ RUN apt-get update && apt-get install -y \ cmake \ curl \ imagemagick \ + ffmpeg \ fontconfig \ g++ \ git \ From 10300a2ecef678c7d3dff9542a732e80c7051a0a Mon Sep 17 00:00:00 2001 From: Brian Vanderbusch Date: Tue, 8 Sep 2020 12:38:57 -0500 Subject: [PATCH 6/7] README tweaks --- README.md | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index e1d19d6..76b6884 100644 --- a/README.md +++ b/README.md @@ -52,11 +52,11 @@ in your container. #### Editing Config files manually -This docker-compose file also contains a container based instance of vscode, accessible +This docker-compose file also contains a container based instance of [vscode][], accessible via your browser at the same url as your octoprint instance, allowing you to edit configuration files without needing to login to your octoprint host. -To make use of this editor, just uncomment the indicated lines in your [docker-compose.yml](docker-compose.yml#20-32) +To make use of this editor, just uncomment the indicated lines in your [docker-compose.yml](docker-compose.yml#L20-L32) then run the following commands: ``` @@ -67,12 +67,15 @@ Now go to `http://:8443` in your browser to edit your octop Use the 'explorer' (accessible by clicking the hamburger menu icon) to explore folder and files to load into the editor workspace. +The active configuration will be accessible at `/config/config.yaml` + When you're done, we recommend you stop and rm this service/container: ``` docker-compose stop config-editor && docker-compose rm config-editor ``` +For full documenation about the config editor, see the docs for the product at [github.com/cdr/code-server][code-server]. ## Without docker-compose @@ -84,3 +87,6 @@ docker volume create octoprint docker run -d -v octoprint:/octoprint --device /dev/ttyACM0:/dev/ttyACM0 --device /dev/video0:/dev/video0 -p 80:80 --name octoprint octoprint/octoprint ``` + +[code-server]: https://github.com/cdr/code-server +[vscode]: https://code.visualstudio.com From 49c73aad2e975e2077fff77ead041e888d67b552 Mon Sep 17 00:00:00 2001 From: Brian Vanderbusch Date: Tue, 8 Sep 2020 13:00:54 -0500 Subject: [PATCH 7/7] open config-editor to octoprint folder --- README.md | 2 +- docker-compose.yml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 76b6884..539db4a 100644 --- a/README.md +++ b/README.md @@ -63,7 +63,7 @@ then run the following commands: docker-compose up -d config-editor ``` -Now go to `http://:8443` in your browser to edit your octoprint files! +Now go to `http://:8443/?folder=/config` in your browser to edit your octoprint files! Use the 'explorer' (accessible by clicking the hamburger menu icon) to explore folder and files to load into the editor workspace. diff --git a/docker-compose.yml b/docker-compose.yml index 4183506..5ac2920 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -29,7 +29,7 @@ services: # - GUID=0 # - TZ=America/Chicago # volumes: - # - octoprint:/octoprint + # - octoprint:/config volumes: octoprint: