Skip to content

Commit 0ace3ae

Browse files
Merge pull request #74 from OctoPrint/add-octoprint-back-to-base-image
Add octoprint back to base image
2 parents 99ec284 + 49c73aa commit 0ace3ae

File tree

6 files changed

+35
-12
lines changed

6 files changed

+35
-12
lines changed

.github/workflows/build.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -39,5 +39,5 @@ jobs:
3939
--platform linux/arm64,linux/amd64,linux/arm/v7 \
4040
--cache-from octoprint/octoprint:cache \
4141
--cache-to octoprint/octoprint:cache \
42-
--build-arg OCTOPRINT_BASE_IMAGE=${{ steps.get-octoprint-release.outputs.release }} \
42+
--build-arg tag=${{ steps.get-octoprint-release.outputs.release }} \
4343
--progress plain -t octoprint/octoprint:ci -f Dockerfile .

.github/workflows/octoprint-release.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,6 @@ jobs:
7474
--platform linux/arm64,linux/amd64,linux/arm/v7 \
7575
--cache-from octoprint/octoprint:cache \
7676
--cache-to octoprint/octoprint:cache \
77-
--build-arg OCTOPRINT_BASE_IMAGE=${{ steps.get-octoprint-release.outputs.release }} \
77+
--build-arg tag=${{ env.tag_name }} \
7878
--progress plain -t octoprint/octoprint:${{ steps.tagging.outputs.tag }} -f Dockerfile .
7979

Dockerfile

+20-3
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
ARG OCTOPRINT_BASE_IMAGE
1+
ARG PYTHON_BASE_IMAGE=3.8-slim-buster
22

33
FROM ubuntu AS s6build
44
ARG S6_RELEASE
@@ -18,16 +18,18 @@ RUN ARCH= && dpkgArch="$(dpkg --print-architecture)" \
1818
&& curl -fsSLO "https://github.com/just-containers/s6-overlay/releases/download/$S6_VERSION/s6-overlay-$ARCH.tar.gz"
1919

2020

21-
FROM octoprint/octoprint:${OCTOPRINT_BASE_IMAGE} AS build
21+
FROM python:${PYTHON_BASE_IMAGE} AS build
2222

23-
USER root
23+
ARG tag
24+
ENV tag ${tag:-master}
2425

2526
RUN apt-get update && apt-get install -y \
2627
avrdude \
2728
build-essential \
2829
cmake \
2930
curl \
3031
imagemagick \
32+
ffmpeg \
3133
fontconfig \
3234
g++ \
3335
git \
@@ -46,6 +48,17 @@ COPY --from=s6build /tmp /tmp
4648
RUN s6tar=$(find /tmp -name "s6-overlay-*.tar.gz") \
4749
&& tar xzf $s6tar -C /
4850

51+
# Install octoprint
52+
RUN curl -fsSLO --compressed --retry 3 --retry-delay 10 \
53+
https://github.com/OctoPrint/OctoPrint/archive/${tag}.tar.gz \
54+
&& mkdir -p /opt/octoprint \
55+
&& tar xzf ${tag}.tar.gz --strip-components 1 -C /opt/octoprint --no-same-owner
56+
57+
WORKDIR /opt/octoprint
58+
RUN pip install -r requirements.txt
59+
RUN python setup.py install
60+
RUN ln -s ~/.octoprint /octoprint
61+
4962
# Install mjpg-streamer
5063
RUN curl -fsSLO --compressed --retry 3 --retry-delay 10 \
5164
https://github.com/jacksonliam/mjpg-streamer/archive/master.tar.gz \
@@ -60,9 +73,13 @@ RUN make install
6073
COPY root /
6174
ENV CAMERA_DEV /dev/video0
6275
ENV MJPEG_STREAMER_INPUT -y -n -r 640x480
76+
ENV PIP_USER true
77+
ENV PYTHONUSERBASE /octoprint/plugins
6378

6479
# port to access haproxy frontend
6580
EXPOSE 80
6681

82+
VOLUME /octoprint
83+
6784
ENTRYPOINT ["/init"]
6885
CMD ["octoprint", "serve", "--iknowwhatimdoing", "--host", "0.0.0.0"]

Makefile

+1-1
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ buildx-test:
3636
--cache-to ${CACHE} \
3737
--build-arg PYTHON_BASE_IMAGE=$(PYTHON_BASE_IMAGE) \
3838
--build-arg tag=${OCTOPRINT_VERSION} \
39-
--progress plain -t ${IMG}:ci .
39+
--progress tty -t ${IMG}:ci .
4040

4141
buildx-push:
4242
@echo '[buildx]: building and pushing images: ${IMG}:${IMG_TAG} for all supported architectures'

README.md

+11-5
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ launch of OctoPrint using docker.
2727
Use the following values in the webcam & timelapse settings screen of the initial setup:
2828

2929
| Setting | Value |
30-
|=========|=======|
30+
| ------- | ----- |
3131
| Stream URL | `/webcam/?action=stream` |
3232
| Snapshot URL | `http://localhost:8080/?action=snapshot` |
3333
| Path to FFMPEG | `/usr/bin/ffmpeg` |
@@ -39,7 +39,7 @@ Listed below are the options and their defaults. These are implicit in example [
3939
and if you wish to change them, refer to the docker-compose docs on setting environment variables.
4040

4141
| variable | default |
42-
|==========|=========|
42+
| -------- | ------- |
4343
| `CAMERA_DEV` | `/dev/video0` (see [note](#devices_note)) |
4444
| `CAMERA_DEV` | `MJPEG_STREAMER_INPUT -y -n -r 640x48` |
4545

@@ -52,27 +52,30 @@ in your container.
5252

5353
#### Editing Config files manually
5454

55-
This docker-compose file also contains a container based instance of vscode, accessible
55+
This docker-compose file also contains a container based instance of [vscode][], accessible
5656
via your browser at the same url as your octoprint instance, allowing you to edit configuration
5757
files without needing to login to your octoprint host.
5858

59-
To make use of this editor, just uncomment the indicated lines in your [docker-compose.yml](docker-compose.yml#20-32)
59+
To make use of this editor, just uncomment the indicated lines in your [docker-compose.yml](docker-compose.yml#L20-L32)
6060
then run the following commands:
6161

6262
```
6363
docker-compose up -d config-editor
6464
```
6565

66-
Now go to `http://<octoprint_ip_or_url>:8443` in your browser to edit your octoprint files!
66+
Now go to `http://<octoprint_ip_or_url>:8443/?folder=/config` in your browser to edit your octoprint files!
6767
Use the 'explorer' (accessible by clicking the hamburger menu icon) to explore folder and files to load
6868
into the editor workspace.
6969

70+
The active configuration will be accessible at `/config/config.yaml`
71+
7072
When you're done, we recommend you stop and rm this service/container:
7173

7274
```
7375
docker-compose stop config-editor && docker-compose rm config-editor
7476
```
7577

78+
For full documenation about the config editor, see the docs for the product at [github.com/cdr/code-server][code-server].
7679

7780
## Without docker-compose
7881

@@ -84,3 +87,6 @@ docker volume create octoprint
8487
docker run -d -v octoprint:/octoprint --device /dev/ttyACM0:/dev/ttyACM0 --device /dev/video0:/dev/video0 -p 80:80 --name octoprint octoprint/octoprint
8588
8689
```
90+
91+
[code-server]: https://github.com/cdr/code-server
92+
[vscode]: https://code.visualstudio.com

docker-compose.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ services:
2929
# - GUID=0
3030
# - TZ=America/Chicago
3131
# volumes:
32-
# - octoprint:/octoprint
32+
# - octoprint:/config
3333

3434
volumes:
3535
octoprint:

0 commit comments

Comments
 (0)