Skip to content

Commit

Permalink
Merge pull request #74 from OctoPrint/add-octoprint-back-to-base-image
Browse files Browse the repository at this point in the history
Add octoprint back to base image
  • Loading branch information
LongLiveCHIEF committed Sep 8, 2020
2 parents 99ec284 + 49c73aa commit 0ace3ae
Show file tree
Hide file tree
Showing 6 changed files with 35 additions and 12 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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 .
2 changes: 1 addition & 1 deletion .github/workflows/octoprint-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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 .
23 changes: 20 additions & 3 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
ARG OCTOPRINT_BASE_IMAGE
ARG PYTHON_BASE_IMAGE=3.8-slim-buster

FROM ubuntu AS s6build
ARG S6_RELEASE
Expand All @@ -18,16 +18,18 @@ 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

USER root
ARG tag
ENV tag ${tag:-master}

RUN apt-get update && apt-get install -y \
avrdude \
build-essential \
cmake \
curl \
imagemagick \
ffmpeg \
fontconfig \
g++ \
git \
Expand All @@ -46,6 +48,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 ln -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 \
Expand All @@ -60,9 +73,13 @@ 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

VOLUME /octoprint

ENTRYPOINT ["/init"]
CMD ["octoprint", "serve", "--iknowwhatimdoing", "--host", "0.0.0.0"]
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand Down
16 changes: 11 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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` |
Expand All @@ -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` |

Expand All @@ -52,27 +52,30 @@ 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:

```
docker-compose up -d config-editor
```

Now go to `http://<octoprint_ip_or_url>:8443` in your browser to edit your octoprint files!
Now go to `http://<octoprint_ip_or_url>: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.

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

Expand All @@ -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
2 changes: 1 addition & 1 deletion docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ services:
# - GUID=0
# - TZ=America/Chicago
# volumes:
# - octoprint:/octoprint
# - octoprint:/config

volumes:
octoprint:

0 comments on commit 0ace3ae

Please sign in to comment.