custom: add unique uid/gid example

This commit is contained in:
Markus Küffner
2023-07-24 17:28:09 +02:00
parent 78d4170488
commit cc3564f1c8
2 changed files with 64 additions and 0 deletions

View File

@@ -9,6 +9,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
## [Unreleased]
### Added
- CHANGELOG.md
- custom/docker-compose.custom.unique-uid-gid.override.yaml
### Fixed
- Github Action Runner running out of space
### Changed

View File

@@ -0,0 +1,63 @@
## Usecase: Run klipper and moonraker with specific UID/GID instead of 1000:1000
## Issue: https://github.com/mkuf/prind/issues/85
##
## Assumptions:
## * I want to use a specific UID/GID for processes in the containers
## * I don't want my config to be readable by 1000:1000
##
## About this setup:
## * this file replaces the main docker-compose.override.yaml
## * klipper image is built at stack startup
## * moonraker image is built at stack startup
## * init container will set the permissions to the new UID/GID
##
## Setup
## 1. Add your personal config to this file and copy it to the root of the repository, overwriting the existing docker-compose.override.yaml
## 2. Replace the example UID and GID of '4242' in the 'dockerfile_inline' block of the klipper and moonraker services,
## as well as in the command of the init service with your specific requirements.
## Make sure to use the identical UIDs/GIDs in klipper and moonraker.
## 3. start the stack as described in the main readme using a profile of your choice.
## Ustreamer base Service
x-ustreamer-svc: &ustreamer-svc
image: mkuf/ustreamer:latest
restart: unless-stopped
command: --host=0.0.0.0 --port=8080 --slowdown --device=/dev/webcam --resolution=1280x960 --format=MJPEG --desired-fps=30
## Add your personal config here
services:
klipper:
image: klipper:custom-gid-uid
build:
dockerfile_inline: |
FROM mkuf/klipper:latest
USER root
RUN usermod -o -u "4242" klipper \
&& groupmod -o -g "4242" klipper \
&& chown -R 4242:4242 /opt
USER klipper
moonraker:
image: moonraker:custom-gid-uid
build:
dockerfile_inline: |
FROM mkuf/moonraker:latest
USER root
RUN usermod -o -u "4242" moonraker \
&& groupmod -o -g "4242" moonraker \
&& chown -R 4242:4242 /opt
USER moonraker
init:
command: chown -R 4242:4242 /prind/config
webcam:
<<: *ustreamer-svc
devices:
- /dev/video0:/dev/webcam
labels:
org.prind.service: webcam
traefik.enable: true
traefik.http.services.webcam.loadbalancer.server.port: 8080
traefik.http.routers.webcam.rule: PathPrefix(`/webcam`)
traefik.http.routers.webcam.entrypoints: web
traefik.http.middlewares.webcam.stripprefix.prefixes: /webcam
traefik.http.routers.webcam.middlewares: webcam