Add test version of 3DPrinter-OctoPrint

This commit is contained in:
Fredrik Baberg 2022-06-27 00:30:50 +02:00
parent 9e53cfdbec
commit 45ddc791b5
15 changed files with 167 additions and 0 deletions

View File

View File

View File

@ -0,0 +1,22 @@
ARG BUILD_FROM="ghcr.io/home-assistant/amd64-base-debian:bullseye"
FROM ${BUILD_FROM}
ARG OCTOPRINT_VERSION="1.8.1"
ENV OCTOPRINT_VERSION=${OCTOPRINT_VERSION}
# Setup path for persistent install of Python packages
ENV PYTHONPATH=/data/python/octoprint
ENV PYTHONUSERBASE=/data/python/octoprint
ENV PATH=${PATH}:/data/python/octoprint/bin
# Install dependencies
RUN apt update && \
apt install -y \
python3-venv \
python3-dev \
build-essential \
&& \
apt clean
# Copy root filesystem
COPY rootfs /

View File

View File

@ -0,0 +1,57 @@
#include <tunables/global>
profile example flags=(attach_disconnected,mediate_deleted) {
#include <abstractions/base>
# Capabilities
file,
signal (send) set=(kill,term,int,hup,cont),
# S6-Overlay
/init ix,
/bin/** ix,
/usr/bin/** ix,
/run/{s6,s6-rc*,service}/** ix,
/package/** ix,
/command/** ix,
/etc/services.d/** rwix,
/etc/cont-init.d/** rwix,
/etc/cont-finish.d/** rwix,
/run/{,**} rwk,
/dev/tty rw,
# Bashio
/usr/lib/bashio/** ix,
/tmp/** rwk,
# Access to options.json and other files within your addon
/data/** rw,
# Start new profile for service
# /usr/bin/my_program cx -> my_program,
profile my_program flags=(attach_disconnected,mediate_deleted) {
#include <abstractions/base>
# Receive signals from S6-Overlay
signal (receive) peer=*_example,
# Access to options.json and other files within your addon
/data/** rw,
# Access to mapped volumes specified in config.json
/share/** rw,
# Access required for service functionality
# Note: List was built by doing the following:
# 1. Add what is obviously needed based on what is in the script
# 2. Add `complain` as a flag to this profile temporarily and run the addon
# 3. Review the audit log with `journalctl _TRANSPORT="audit" -g 'apparmor="ALLOWED"'` and add other access as needed
# Remember to remove the `complain` flag when you are done
# /usr/bin/my_program r,
/bin/bash rix,
/bin/echo ix,
/etc/passwd r,
/dev/tty rw,
}
}

View File

@ -0,0 +1,12 @@
build_from:
aarch64: ghcr.io/home-assistant/aarch64-base-debian:bullseye
amd64: ghcr.io/home-assistant/amd64-base-debian:bullseye
armhf: ghcr.io/home-assistant/armhf-base-debian:bullseye
armv7: ghcr.io/home-assistant/armv7-base-debian:bullseye
i386: ghcr.io/home-assistant/i386-base-debian:bullseye
labels:
org.opencontainers.image.title: "Home Assistant Add-on: 3DPrinter-OctoPrint add-on"
org.opencontainers.image.description: "3DPrinter-OctoPrint addon for Home-Assistant."
org.opencontainers.image.source: "https://github.com/fredrikbaberg/home-assistant-addons"
args:
OCTOPRINT_VERSION: "1.8.1"

View File

@ -0,0 +1,20 @@
name: "3DPrinter-OctoPrint"
version: "2022.6.010"
slug: "3dprinter-octoprint"
description: "Instance of OctoPrint"
url: "https://github.com/fredrikbaberg/home-assistant-addons/tree/main/3dprinter-octoprint"
arch:
- aarch64
- amd64
- armhf
- armv7
- i386
init: false
map:
- share:rw
options:
message: "Hello world..."
schema:
message: "str?"
ports:
5000/tcp: null

Binary file not shown.

After

Width:  |  Height:  |  Size: 48 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 74 KiB

View File

@ -0,0 +1,16 @@
#!/usr/bin/with-contenv bashio
# ==============================================================================
# Prepare OctoPrint
# s6-overlay docs: https://github.com/just-containers/s6-overlay
# ==============================================================================
{ # Check if OctoPrint is installed
octoprint --version
} || { # Otherwise install
{ # Check if Python is available
python --version
} || { # Otherwise install
python3 -m venv /data/python/octoprint
}
pip install octoprint==$OCTOPRINT_VERSION
}

View File

@ -0,0 +1,12 @@
#!/usr/bin/env bashio
# ==============================================================================
# Take down the S6 supervision tree when example fails
# s6-overlay docs: https://github.com/just-containers/s6-overlay
# ==============================================================================
if [[ "$1" -ne 0 ]] && [[ "$1" -ne 256 ]]; then
bashio::log.warning "Halt add-on"
exec /run/s6/basedir/bin/halt
fi
bashio::log.info "Service restart after closing"

View File

@ -0,0 +1,8 @@
#!/usr/bin/with-contenv bashio
# ==============================================================================
# Start OctoPrint
# s6-overlay docs: https://github.com/just-containers/s6-overlay
# ==============================================================================
## Run your program
exec octoprint serve --iknowwhatimdoing --host 0.0.0.0 --port 5000 --basedir /data/config/octoprint

View File

@ -0,0 +1,4 @@
configuration:
message:
name: Message
description: The message that will be printed to the log when starting this example add-on.

View File

@ -1,2 +1,15 @@
# home-assistant-addons
Addons for Home Assistant.
## Install
You can use the following button to add the repository to your Home Assistant instance.
[![Open your Home Assistant instance and show the add add-on repository dialog with a specific repository URL pre-filled.](https://my.home-assistant.io/badges/supervisor_add_addon_repository.svg)](https://my.home-assistant.io/redirect/supervisor_add_addon_repository/?repository_url=https%3A%2F%2Fgithub.com%2Ffredrikbaberg%2Fhome-assistant-addons)
## Addons
### 3DPrinter-OctoPrint
Addon with OctoPrint

3
repository.yaml Normal file
View File

@ -0,0 +1,3 @@
name: fredrikbaberg Home-Asssistant addons
url: https://github.com/fredrikbaberg/home-assistant-addons
maintainer: Fredrik Baberg <fredrik.baberg@gmail.com>