Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Pre configure unique docker configs #132

Merged
merged 6 commits into from
Dec 6, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,3 @@ config/logs
config/timelapse
config/uploads
buildtest
compose.test.yml
32 changes: 0 additions & 32 deletions CONTRIBUTING.md

This file was deleted.

3 changes: 2 additions & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -73,11 +73,12 @@ ENV CAMERA_DEV /dev/video0
ENV MJPG_STREAMER_INPUT -y -n -r 640x480
ENV PIP_USER true
ENV PYTHONUSERBASE /octoprint/plugins
# set WORKDIR
WORKDIR /octoprint

# port to access haproxy frontend
EXPOSE 80

VOLUME /octoprint

ENTRYPOINT ["/init"]
CMD ["octoprint", "serve", "--iknowwhatimdoing", "--host", "0.0.0.0", "--basedir", "/octoprint"]
78 changes: 7 additions & 71 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,75 +1,11 @@
#import config.
# You can change the default config with `make cnf="config_special.env" build`
cnf ?= env.mk
include $(cnf)
CACHE = $(REGISTRY)/$(IMAGE):cache
IMG = $(REGISTRY)/$(IMAGE)

OCTOPRINT_VERSION?= $(shell ./scripts/version.sh "OctoPrint/OctoPrint")
IMG_TAG=${OCTOPRINT_VERSION}-python3

.DEFAULT_GOAL := build
.PHONY: camera buildx-camera

clean:
docker stop buildkit && docker rm buildkit

install: ./scripts/install.sh

binfmt:
@docker run --rm --privileged docker/binfmt:a7996909642ee92942dcd6cff44b9b95f08dad64

prepare:
@docker buildx create --use

build:
@echo '[default]: building local octoprint image with all default options'
@docker build -t octoprint .

dry-run:
@echo '[buildx]: building image: ${IMG}:${IMG_TAG} for all architectures'
docker-compose -f compose.test.yml build

buildx-test:
@echo '[buildx]: building image: ${IMG}:ci for all architectures'
@docker buildx build --push --platform $(PLATFORMS) \
--cache-from ${CACHE} \
--cache-to ${CACHE} \
--build-arg PYTHON_BASE_IMAGE=$(PYTHON_BASE_IMAGE) \
--build-arg octoprint_ref=${OCTOPRINT_VERSION} \
--progress tty -t ${IMG}:ci .

buildx-push:
@echo '[buildx]: building and pushing images: ${IMG}:${IMG_TAG} for all supported architectures'
docker buildx build --push --platform $(PLATFORMS) \
--cache-from ${CACHE} \
--cache-to ${CACHE} \
--build-arg PYTHON_BASE_IMAGE=$(PYTHON_BASE_IMAGE) \
--build-arg octoprint_ref=${OCTOPRINT_VERSION} \
--progress plain -t ${IMG}:${IMG_TAG} .

camera:
@echo 'building camera image for this hosts platform'
docker build --build-arg OCTOPRINT_BASE_IMAGE=1.4.2 \
-t octoprint/octoprint:camera -f ./camera/Dockerfile.camera .

buildx-camera:
@echo '[buildx]: building camera image for all supported platforms'
docker buildx build --push --platform $(PLATFORMS) \
--cache-from ${CACHE} \
--cache-to ${CACHE} \
--build-arg OCTOPRINT_BASE_IMAGE=1.4.2 \
--progress plain -t octoprint/octoprint:ci-camera -f ./camera/Dockerfile.camera .

test-up:
docker-compose -f compose.test.yml up -d
@docker-compose -f compose.test.yml logs -f octoprint

test-stop:
@docker-compose -f compose.test.yml stop
down:
docker-compose -f compose.test.yml down

test-start:
docker-compose -f compose.test.yml start
@docker-compose -f compose.test.yml logs -f octoprint
up:
docker-compose -f compose.test.yml up

test-clean:
docker-compose -f compose.test.yml down
clean:
docker-compose -f compose.test.yml down --rmi local -v
11 changes: 0 additions & 11 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ same out of the box features as the octopi raspberry-pi machine image, using doc
- [Usage](#usage)
- [Configuration](#configuration)
- [Enabling Webcam Support with Docker](#enabling-webcam-support-with-docker)
- [Webcam Setup in OctoPrint](#webcam-setup-in-octoprint)
- [Container Environment based configs](#container-environment-based-configs)
- [Editing Config files manually](#editing-config-files-manually)
- [Without docker-compose](#without-docker-compose)
Expand Down Expand Up @@ -52,16 +51,6 @@ environment variable for `CAMERA_DEV` to match the mapped device mapping.
See [container environment based configs](#container-environment-based-configs) for a full
list of webcam configuration options configured with docker.

#### Webcam Setup in OctoPrint

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` |

#### Container Environment based configs

There are configuration values that you pass using container `--environment` options.
Expand Down
30 changes: 30 additions & 0 deletions compose.test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
version: '2.4'

services:
octoprint:
build:
context: ./
args:
octoprint_ref: 1.5.1
image: octoprint/octoprint:test
ports:
- 53333:80
volumes:
- octoprint:/octoprint

config-editor:
image: linuxserver/code-server
ports:
- 8443:8443
depends_on:
- octoprint
restart: unless-stopped
environment:
- PUID=0
- GUID=0
- TZ=America/Chicago
volumes:
- octoprint:/config

volumes:
octoprint:
8 changes: 0 additions & 8 deletions env.mk

This file was deleted.

3 changes: 3 additions & 0 deletions root/etc/services.d/octoprint/run
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
#!/usr/bin/with-contenv sh

exec octoprint serve --iknowwhatimdoing --host 0.0.0.0 --basedir /octoprint
10 changes: 10 additions & 0 deletions root/octoprint/config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
server:
commands:
serverRestartCommand: s6-svc -r /var/run/s6/services/octoprint
webcam:
ffmpeg: /usr/bin/ffmpeg
snapshot: http://localhost:8080/?action=snapshot
stream: /webcam/?action=stream
plugins:
_disabled:
- backup