fix(docker): change default user to root and update entrypoint script
- Set default UID and GID environment variables to 0 (root) in Dockerfile - Update entrypoint script to reflect running as root is now default behavior - Remove ownership change commands for directories in entrypoint script - Log the running user message with updated UID and GID values - Ensure application runs with su-exec using root user credentials
This commit is contained in:
parent
3bef839e18
commit
c3fea47248
|
|
@ -0,0 +1,2 @@
|
|||
docker push 192.168.2.212:3000/tigeren/metube:1.0
|
||||
docker build -t 192.168.2.212:3000/tigeren/metube:1.0 .
|
||||
|
|
@ -26,8 +26,8 @@ RUN sed -i 's/\r$//g' docker-entrypoint.sh && \
|
|||
COPY app ./app
|
||||
COPY --from=builder /metube/dist/metube ./ui/dist/metube
|
||||
|
||||
ENV UID=1000
|
||||
ENV GID=1000
|
||||
ENV UID=0
|
||||
ENV GID=0
|
||||
ENV UMASK=022
|
||||
|
||||
ENV DOWNLOAD_DIR /downloads
|
||||
|
|
|
|||
|
|
@ -0,0 +1,104 @@
|
|||
version: '3.8'
|
||||
|
||||
services:
|
||||
metube:
|
||||
build: .
|
||||
image: metube:latest
|
||||
container_name: metube
|
||||
restart: unless-stopped
|
||||
ports:
|
||||
- "8081:8081"
|
||||
volumes:
|
||||
- ./downloads:/downloads
|
||||
- ./metube-config:/config
|
||||
# Optional: mount cookies file for authenticated downloads
|
||||
# - ./cookies:/cookies:ro
|
||||
environment:
|
||||
# Basic configuration
|
||||
- UID=0
|
||||
- GID=0
|
||||
- UMASK=022
|
||||
|
||||
# Download directories
|
||||
- DOWNLOAD_DIR=/downloads
|
||||
- STATE_DIR=/config
|
||||
- TEMP_DIR=/downloads
|
||||
|
||||
# Download behavior
|
||||
- DOWNLOAD_MODE=limited
|
||||
- MAX_CONCURRENT_DOWNLOADS=3
|
||||
- DELETE_FILE_ON_TRASHCAN=false
|
||||
|
||||
# Custom directories
|
||||
- CUSTOM_DIRS=true
|
||||
- CREATE_CUSTOM_DIRS=true
|
||||
- CUSTOM_DIRS_EXCLUDE_REGEX=(^|/)[.@].*$
|
||||
- DOWNLOAD_DIRS_INDEXABLE=false
|
||||
|
||||
# File naming
|
||||
- OUTPUT_TEMPLATE=%(title)s.%(ext)s
|
||||
- OUTPUT_TEMPLATE_CHAPTER=%(title)s - %(section_number)s %(section_title)s.%(ext)s
|
||||
- OUTPUT_TEMPLATE_PLAYLIST=%(playlist_title)s/%(title)s.%(ext)s
|
||||
|
||||
# Playlist options
|
||||
- DEFAULT_OPTION_PLAYLIST_STRICT_MODE=false
|
||||
- DEFAULT_OPTION_PLAYLIST_ITEM_LIMIT=0
|
||||
|
||||
# Web server
|
||||
- URL_PREFIX=
|
||||
- PUBLIC_HOST_URL=download/
|
||||
- PUBLIC_HOST_AUDIO_URL=audio_download/
|
||||
- HOST=0.0.0.0
|
||||
- PORT=8081
|
||||
|
||||
# Logging
|
||||
- LOGLEVEL=INFO
|
||||
- ENABLE_ACCESSLOG=false
|
||||
|
||||
# Theme
|
||||
- DEFAULT_THEME=auto
|
||||
|
||||
# Optional: yt-dlp options
|
||||
# - YTDL_OPTIONS={}
|
||||
# - YTDL_OPTIONS_FILE=/path/to/ytdl_options.json
|
||||
|
||||
# Optional: cookies for authenticated downloads
|
||||
# - YTDL_OPTIONS={"cookiefile":"/cookies/cookies.txt"}
|
||||
|
||||
# Optional: HTTPS configuration
|
||||
# - HTTPS=true
|
||||
# - CERTFILE=/ssl/cert.pem
|
||||
# - KEYFILE=/ssl/key.pem
|
||||
|
||||
# Optional: robots.txt
|
||||
# - ROBOTS_TXT=/app/robots.txt
|
||||
|
||||
# Optional: health check
|
||||
healthcheck:
|
||||
test: ["CMD", "curl", "-f", "http://localhost:8081/version"]
|
||||
interval: 30s
|
||||
timeout: 10s
|
||||
retries: 3
|
||||
start_period: 40s
|
||||
|
||||
# Optional: resource limits
|
||||
# deploy:
|
||||
# resources:
|
||||
# limits:
|
||||
# cpus: '2.0'
|
||||
# memory: 2G
|
||||
# reservations:
|
||||
# cpus: '0.5'
|
||||
# memory: 512M
|
||||
|
||||
# Optional: networks configuration
|
||||
# networks:
|
||||
# default:
|
||||
# name: metube-network
|
||||
|
||||
# Optional: named volumes
|
||||
# volumes:
|
||||
# metube-downloads:
|
||||
# driver: local
|
||||
# metube-cookies:
|
||||
# driver: local
|
||||
|
|
@ -7,10 +7,8 @@ mkdir -p "${DOWNLOAD_DIR}" "${STATE_DIR}" "${TEMP_DIR}"
|
|||
|
||||
if [ `id -u` -eq 0 ] && [ `id -g` -eq 0 ]; then
|
||||
if [ "${UID}" -eq 0 ]; then
|
||||
echo "Warning: it is not recommended to run as root user, please check your setting of the UID environment variable"
|
||||
echo "Running as root user (UID=0, GID=0) - this is now the default configuration"
|
||||
fi
|
||||
echo "Changing ownership of download and state directories to ${UID}:${GID}"
|
||||
chown -R "${UID}":"${GID}" /app "${DOWNLOAD_DIR}" "${STATE_DIR}" "${TEMP_DIR}"
|
||||
echo "Running MeTube as user ${UID}:${GID}"
|
||||
exec su-exec "${UID}":"${GID}" python3 app/main.py
|
||||
else
|
||||
|
|
|
|||
Loading…
Reference in New Issue