A self-hosted media server and file management system
Vue ffmpegfile-serverjellyfinlaravelmediamedia-playermedia-servermediabrowsermediaservermusicmusic-librarymusic-playermusicplayerself-hostedvuejs
fix(tentative): should use 1000 uid (translates to system) over 9999 to maintain file access
aminnausin223030e27394
diff --git a/Dockerfile b/Dockerfileindex f359c720..58b4c599 100644--- a/Dockerfile+++ b/Dockerfile@@ -5,8 +5,8 @@ ARG SERVERSIDEUP_PHP_VERSION=8.4-fpm-nginx-alpineARG POSTGRES_VERSION=17# Add user/group-ARG USER_ID=9999-ARG GROUP_ID=9999+ARG USER_ID=1000+ARG GROUP_ID=1000# =================================================================# 1: Install composer dependencies@@ -51,17 +51,11 @@ FROM node:24.2-slim AS puppeteerWORKDIR /app-# RUN npm install puppeteer --production && npm cache clean --forceENV PUPPETEER_SKIP_CHROMIUM_DOWNLOAD=trueRUN npm install puppeteer --ignore-scripts --omit=dev && \npm cache clean --force-# ENV PUPPETEER_CACHE_DIR=/app/puppeteer-cache--# RUN npm install puppeteer && npm prune --omit=dev \-# && npx puppeteer browsers install chrome-# =================================================================# 3: Compile Laravel Image# =================================================================@@ -80,20 +74,20 @@ RUN docker-php-serversideup-set-id www-data "$USER_ID":"$GROUP_ID" && \docker-php-serversideup-set-file-permissions --owner "$USER_ID":"$GROUP_ID" --service nginx && \apk add --no-cache gnupg && \mkdir -p /usr/share/keyrings && \- curl --proto "=https" -fSsL https://www.postgresql.org/media/keys/ACCC4CF8.asc | gpg --dearmor > /usr/share/keyrings/postgresql.gpg \- && apk update \- && apk add --no-cache \- ca-certificates \- chromium \- exiftool \- ffmpeg \- freetype \- git \- harfbuzz \- nodejs \- npm \- nss \- ttf-freefont && \+ curl --proto "=https" -fSsL https://www.postgresql.org/media/keys/ACCC4CF8.asc | gpg --dearmor > /usr/share/keyrings/postgresql.gpg && \+ apk update && \+ apk add --no-cache \+ ca-certificates \+ chromium \+ exiftool \+ ffmpeg \+ freetype \+ git \+ harfbuzz \+ nodejs \+ npm \+ nss \+ ttf-freefont && \rm -rf /var/cache/apk/*# Configure PHP@@ -103,11 +97,15 @@ ENV PHP_OPCACHE_ENABLE=1# Configure entrypointCOPY --chmod=755 docker/entrypoint.d/ /etc/entrypoint.d-# Copy default files-RUN mkdir -p /var/www/html/storage/app/public/avatars \- /var/www/html/storage/app/public/thumbnails \- /var/www/html/shared+# Configure storage and generate chrome config directories+RUN mkdir -p /var/www/html/shared \+ /var/www/html/storage/app/public/avatars \+ /var/www/html/storage/app/public/thumbnails \+ /var/www/html/storage/app/private \+ /var/www/html/storage/logs \+ /var/www/html/storage/app/chrome/.config+# Copy default filesCOPY storage/app/public /var/www/html/storage/app/public# Copy dependencies@@ -122,18 +120,20 @@ COPY --chown=www-data:www-data .env.example .env# Copy .git folder for manifest generation at runtimeCOPY --chown=www-data:www-data .git .git-# Set permissions for Laravel runtime and generate chrome config directories+# Set permissions for Laravel runtimeRUN composer dump-autoload && \- mkdir -p /var/www/html/storage/app/chrome/.config && \- chown -R www-data:www-data /var/www/html/storage && \- chmod -R g+ws /var/www/html/storage && \+ chown -R www-data:www-data /var/www/html/storage /var/www/html/shared && \+ chmod -R 775 /var/www/html/storage /var/www/html/shared && \chmod 644 /var/www/html/.env && \- chmod -R 775 /var/www/html/storage/app/chrome+ chmod g+s /var/www/html/storage/app/private \+ /var/www/html/storage/app/public \+ /var/www/html/storage/logs \+ /var/www/html/shared# NginxCOPY docker/etc/nginx/conf.d/default.conf /etc/nginx/conf.d/default.confRUN chown -R www-data:www-data /etc/nginx && \- chmod -R 755 /etc/nginx && \+ chmod -R 775 /etc/nginx && \rm -rf /tmp/* /root/.npm /root/.cache /home/www-data/.cache /usr/share/man /usr/share/doc /var/cache/apk/*ENV AUTORUN_ENABLED=truediff --git a/startDocker.bat b/startDocker.batindex 8752b1d5..e26b7d52 100644--- a/startDocker.bat+++ b/startDocker.bat@@ -1,8 +1,8 @@@echo offSET "SHARED_VOLUME_NAME=mediaserver-shared-env"-SET "VOLUME_UID=9999"-SET "VOLUME_GID=9999"+SET "VOLUME_UID=1000"+SET "VOLUME_GID=1000"SET "ENV_FILE=./.env"SET "FALLBACK_DEFAULT_DOMAIN=app.test"SET "NGINX_CONF_FILE=docker\etc\nginx\conf.d\default.conf"diff --git a/startDocker.sh b/startDocker.shindex d7948311..d94f5003 100644--- a/startDocker.sh+++ b/startDocker.sh@@ -2,8 +2,8 @@# --- Configuration ---SHARED_VOLUME_NAME="mediaserver-shared-env"-VOLUME_UID="9999"-VOLUME_GID="9999"+PUID="1000"+PGID="1000"ENV_FILE="./.env" # Path to your .env fileFALLBACK_DEFAULT_DOMAIN="app.test" # Default if APP_URL is not found in .envNGINX_CONF_FILE="docker/etc/nginx/conf.d/default.conf" # Path to Nginx config@@ -104,7 +104,7 @@ fiecho# Ensure permissions are set for data directories-sudo chown -R 9999:9999 data app+sudo chown -R ${PUID}:${PGID} data appsudo chmod -R 775 data appif [[ $? -ne 0 ]]; thenecho -e "${RED}[ERROR]${RESET} Failed to create 'data/app' subdirectories or set permissions."@@ -118,9 +118,9 @@ if [[ ! -d "logs" ]]; thenmkdir -p "logs/mediaServer"mkdir -p "logs/nginx"mkdir -p "logs/caddy"- sudo chown -R 9999:9999 ./logs/nginx- sudo chown -R 9999:9999 ./logs/mediaServer- sudo chmod -R 755 logs+ sudo chown -R ${PUID}:${PGID} ./logs/nginx+ sudo chown -R ${PUID}:${PGID} ./logs/mediaServer+ sudo chmod -R 775 logsif [[ $? -ne 0 ]]; thenecho -e "${RED}[ERROR]${RESET} Failed to create 'logs' directory."exit 1@@ -267,7 +267,7 @@ echo -e "${BLUE}[INFO]${RESET} Setting permissions on shared volume '$SHARED_VOLechodocker run --rm \-v "${SHARED_VOLUME_NAME}:/shared" \- alpine sh -c "mkdir -p /shared && chown -R ${VOLUME_UID}:${VOLUME_GID} /shared && chmod 775 /shared && echo 'Volume permissions set.'"+ alpine sh -c "mkdir -p /shared && chown -R ${PUID}:${PGID} /shared && chmod 775 /shared && echo 'Volume permissions set.'"if [[ $? -ne 0 ]]; thenecho -e "${RED}[ERROR]${RESET} Failed to set shared volume permissions."