Skip to content

A self-hosted media server and file management system

fix: docker release has incorrect default files and config

aminnausin10fbc63aa727
diff --git a/.github/workflows/ci-docker-release.yml b/.github/workflows/ci-docker-release.yml
index fd1d8c54..cabf25fe 100644
--- a/.github/workflows/ci-docker-release.yml
+++ b/.github/workflows/ci-docker-release.yml
@@ -200,13 +200,22 @@ jobs:
- name: Checkout Repository
uses: actions/checkout@v4
+ - name: Prepare default data files for release
+ run: |
+ mkdir -p temp
+ cp -r storage/app/public temp/data
+
- name: Zip Files Linux
run: |
- zip -r mediaServerDockerLinux.zip ./docker/etc ./docker/.env.docker ./docker-compose.yaml ./startDocker.sh ./README.md ./data/*
+ zip -r mediaServerDockerLinux.zip ./docker/etc ./docker/.env.docker ./docker-compose.yaml ./startDocker.sh ./README.md temp/data
- name: Zip Files Windows
run: |
- zip -r mediaServerDockerWindows.zip ./docker/etc ./docker/.env.docker ./docker-compose.yaml ./startDocker.bat ./README.md ./data/*
+ zip -r mediaServerDockerWindows.zip ./docker/etc ./docker/.env.docker ./docker-compose.yaml ./startDocker.bat ./README.md temp/data
+
+ - name: Cleanup temp
+ run: rm -rf temp
+
- name: Create Release
uses: ncipollo/release-action@v1
with:
diff --git a/Dockerfile b/Dockerfile
index 0d47679d..19dacd8f 100644
--- a/Dockerfile
+++ b/Dockerfile
@@ -27,6 +27,26 @@ RUN composer install --no-dev --no-interaction --no-plugins --no-scripts --prefe
USER www-data
+# =================================================================
+# 1.5: Generate app manifest (intermediate builder)
+# =================================================================
+FROM serversideup/php:${SERVERSIDEUP_PHP_VERSION} AS manifest
+
+USER root
+WORKDIR /var/www/html
+
+# Copy laravel app
+COPY . .
+
+# Copy installed dependencies
+COPY --from=composer /var/www/html/vendor ./vendor
+
+# Install Git
+RUN apk add --no-cache git
+
+# Generate app manifest
+RUN php artisan app:manifest
+
# =================================================================
# 2: Build Frontend
# =================================================================
@@ -88,7 +108,6 @@ RUN docker-php-serversideup-set-id www-data "$USER_ID":"$GROUP_ID" && \
harfbuzz \
nodejs \
npm \
- git \
nss \
ttf-freefont && \
rm -rf /var/cache/apk/*
@@ -112,6 +131,7 @@ COPY storage/app/public/thumbnails/default.webp /var/www/html/storage/app/public
COPY --from=composer --chown=www-data:www-data /var/www/html/vendor ./vendor
COPY --from=builder --chown=www-data:www-data /var/www/html/public/build ./public/build
COPY --from=puppeteer /app/node_modules ./node_modules
+COPY --from=manifest /var/www/html/VERSION VERSION
COPY --chown=www-data:www-data . .
RUN composer dump-autoload \
diff --git a/docker-compose.yaml b/docker-compose.yaml
index 14ba7d14..2e4d67f5 100644
--- a/docker-compose.yaml
+++ b/docker-compose.yaml
@@ -1,179 +1,179 @@
services:
- volume-prep:
- image: alpine
- command: >
- sh -c "
- mkdir -p /shared &&
- chown -R 9999:9999 /shared &&
- chmod 775 /shared &&
- echo 'Volume ready'"
- volumes:
- - shared-env:/shared
- networks:
- - mediaServer-db
- restart: on-failure
- app: &app
- image: aminnausin/mediaserver:${DOCKER_RELEASE:-latest}
- container_name: MediaServer
- volumes:
- - ./data:/var/www/html/storage/app/public
- - ./logs/mediaServer:/var/www/html/storage/logs
- - ./docker/etc/nginx/conf.d/default.conf:/etc/nginx/conf.d/default.conf
- - ./docker/etc/nginx/nginx.conf:/etc/nginx/nginx.conf
- - ./logs/nginx:/var/log/nginx
- - shared-env:/var/www/html/shared
- ports:
- - '${APP_PORT:-8080}:8080'
- expose:
- - '${APP_PORT:-8080}'
- environment:
- - SHARED_UID=9999
- - SHARED_GID=9999
- healthcheck:
- test: curl --fail http://${APP_HOST:-app.test}:8080/api/health || exit 1
- # test: ['CMD', 'sh', '-c', 'test -f /var/www/html/shared/.env && curl --fail http://${APP_HOST:-app.test}:8080/api/health']
- #-f /var/www/html/shared/.env &&
- interval: 15s
- timeout: 10s
- retries: 3
- depends_on:
- postgres:
- condition: service_healthy
- # volume-prep:
- # condition: service_completed_successfully
- env_file:
- - .env
- labels:
- caddy: ${APP_HOST:-app.test}
- caddy.reverse_proxy: '* {{upstreams 8080}}'
- networks:
- mediaServer-db:
- default:
- aliases:
- - app.test
- queue:
- <<: *app
- container_name: job_queue
- command: ['php', '/var/www/html/artisan', 'queue:work', '--tries=3']
- environment:
- - LOG_FILENAME=laravel-queue.log
- ports: []
- expose: []
- stop_grace_period: 5s
- stop_signal: SIGTERM
- depends_on:
- app:
- condition: service_healthy
- healthcheck:
- test: ['CMD', 'healthcheck-queue']
- start_period: 10s
- networks:
- mediaServer-db:
- default:
- aliases: []
- event-queue:
- <<: *app
- container_name: event_queue
- command: ['php', '/var/www/html/artisan', 'queue:work', '--queue=high', '--tries=3']
- environment:
- - LOG_FILENAME=laravel-event-queue.log
- ports: []
- expose: []
- stop_grace_period: 5s
- stop_signal: SIGTERM
- depends_on:
- app:
- condition: service_healthy
- healthcheck:
- test: ['CMD', 'healthcheck-queue']
- networks:
- mediaServer-db:
- default:
- aliases: []
- scheduler:
- <<: *app
- container_name: laravel_scheduler
- command: ['php', '/var/www/html/artisan', 'schedule:work']
- environment:
- - LOG_FILENAME=laravel-scheduler.log
- ports: []
- expose: []
- stop_grace_period: 5s
- stop_signal: SIGTERM
- depends_on:
- app:
- condition: service_healthy
- healthcheck:
- test: ['CMD', 'healthcheck-schedule']
- networks:
- mediaServer-db:
- default:
- aliases: []
- ws:
- <<: *app
- container_name: ws
- command: php artisan reverb:start
- ports: []
- expose:
- - 6001
- environment:
- - LOG_FILENAME=laravel-ws.log
- labels:
- caddy: ${APP_HOST:-app.test}
- caddy.reverse_proxy: '* {{upstreams 6001}}'
- stop_grace_period: 5s
- stop_signal: SIGTERM
- depends_on:
- app:
- condition: service_healthy
- healthcheck:
- test: ['CMD', 'healthcheck-schedule']
- networks:
- mediaServer-db:
- default:
- aliases: []
- caddy:
- image: 'caddy:2.9.1-alpine'
- container_name: caddy
- ports:
- - 80:80
- - 443:443
- - 443:443/udp
- volumes:
- - ./docker/etc/caddy/Caddyfile:/etc/caddy/Caddyfile
- - ./logs/caddy:/var/log/caddy
- - /var/run/docker.sock:/var/run/docker.sock
- restart: unless-stopped
- environment:
- - CADDY_INGRESS_NETWORKS=proxy_network
- postgres:
- image: bitnami/postgresql:17.2.0
- container_name: database
- platform: linux/amd64
- ports:
- - 5432:5432
- restart: always
- volumes:
- - db-data:/bitnami/postgresql
- environment:
- - POSTGRESQL_DATABASE=${DB_DATABASE:-mediaServer}
- - POSTGRESQL_USERNAME=${DB_USERNAME:-postgres}
- - POSTGRESQL_PASSWORD=${DB_PASSWORD:-root}
- healthcheck:
- test: ['CMD-SHELL', 'pg_isready -U ${DB_USERNAME}', '-d', '${DB_DATABASE:-mediaServer}']
- interval: 5s
- timeout: 2s
- retries: 10
- networks:
- - mediaServer-db
+ volume-prep:
+ image: alpine
+ command: >
+ sh -c "
+ mkdir -p /shared &&
+ chown -R 9999:9999 /shared &&
+ chmod 775 /shared &&
+ echo 'Volume ready'"
+ volumes:
+ - shared-env:/shared
+ networks:
+ - mediaServer-db
+ restart: on-failure
+ app: &app
+ image: aminnausin/mediaserver:${DOCKER_RELEASE:-latest}
+ container_name: MediaServer
+ volumes:
+ - ./data:/var/www/html/storage/app/public
+ - ./logs/mediaServer:/var/www/html/storage/logs
+ - ./docker/etc/nginx/conf.d/default.conf:/etc/nginx/conf.d/default.conf
+ - ./docker/etc/nginx/nginx.conf:/etc/nginx/nginx.conf
+ - ./logs/nginx:/var/log/nginx
+ - shared-env:/var/www/html/shared
+ ports:
+ - '${APP_PORT:-8080}:8080'
+ expose:
+ - '${APP_PORT:-8080}'
+ environment:
+ - SHARED_UID=9999
+ - SHARED_GID=9999
+ healthcheck:
+ test: curl --fail http://${APP_HOST:-app.test}:8080/api/health || exit 1
+ # test: ['CMD', 'sh', '-c', 'test -f /var/www/html/shared/.env && curl --fail http://${APP_HOST:-app.test}:8080/api/health']
+ #-f /var/www/html/shared/.env &&
+ interval: 15s
+ timeout: 10s
+ retries: 3
+ depends_on:
+ postgres:
+ condition: service_healthy
+ # volume-prep:
+ # condition: service_completed_successfully
+ env_file:
+ - .env
+ labels:
+ caddy: ${APP_HOST:-app.test}
+ caddy.reverse_proxy: '* {{upstreams 8080}}'
+ networks:
+ mediaServer-db:
+ default:
+ aliases:
+ - app.test
+ queue:
+ <<: *app
+ container_name: job_queue
+ command: ['php', '/var/www/html/artisan', 'queue:work', '--tries=3']
+ environment:
+ - LOG_FILENAME=laravel-queue.log
+ ports: []
+ expose: []
+ stop_grace_period: 5s
+ stop_signal: SIGTERM
+ depends_on:
+ app:
+ condition: service_healthy
+ healthcheck:
+ test: ['CMD', 'healthcheck-queue']
+ start_period: 10s
+ networks:
+ mediaServer-db:
+ default:
+ aliases: []
+ event-queue:
+ <<: *app
+ container_name: event_queue
+ command: ['php', '/var/www/html/artisan', 'queue:work', '--queue=high', '--tries=3']
+ environment:
+ - LOG_FILENAME=laravel-event-queue.log
+ ports: []
+ expose: []
+ stop_grace_period: 5s
+ stop_signal: SIGTERM
+ depends_on:
+ app:
+ condition: service_healthy
+ healthcheck:
+ test: ['CMD', 'healthcheck-queue']
+ networks:
+ mediaServer-db:
+ default:
+ aliases: []
+ scheduler:
+ <<: *app
+ container_name: laravel_scheduler
+ command: ['php', '/var/www/html/artisan', 'schedule:work']
+ environment:
+ - LOG_FILENAME=laravel-scheduler.log
+ ports: []
+ expose: []
+ stop_grace_period: 5s
+ stop_signal: SIGTERM
+ depends_on:
+ app:
+ condition: service_healthy
+ healthcheck:
+ test: ['CMD', 'healthcheck-schedule']
+ networks:
+ mediaServer-db:
+ default:
+ aliases: []
+ ws:
+ <<: *app
+ container_name: ws
+ command: php artisan reverb:start
+ ports: []
+ expose:
+ - 6001
+ environment:
+ - LOG_FILENAME=laravel-ws.log
+ labels:
+ caddy: ${APP_HOST:-app.test}
+ caddy.reverse_proxy: '* {{upstreams 6001}}'
+ stop_grace_period: 5s
+ stop_signal: SIGTERM
+ depends_on:
+ app:
+ condition: service_healthy
+ healthcheck:
+ test: ['CMD', 'healthcheck-schedule']
+ networks:
+ mediaServer-db:
+ default:
+ aliases: []
+ caddy:
+ image: 'caddy:2.9.1-alpine'
+ container_name: caddy
+ ports:
+ - 80:80
+ - 443:443
+ - 443:443/udp
+ volumes:
+ - ./docker/etc/caddy/Caddyfile:/etc/caddy/Caddyfile
+ - ./logs/caddy:/var/log/caddy
+ - /var/run/docker.sock:/var/run/docker.sock
+ restart: unless-stopped
+ environment:
+ - CADDY_INGRESS_NETWORKS=proxy_network
+ postgres:
+ image: bitnami/postgresql:17.2.0
+ container_name: database
+ platform: linux/amd64
+ ports:
+ - 5432:5432
+ restart: always
+ volumes:
+ - db-data:/bitnami/postgresql
+ environment:
+ - POSTGRESQL_DATABASE=${DB_DATABASE:-mediaServer}
+ - POSTGRESQL_USERNAME=${DB_USERNAME:-postgres}
+ - POSTGRESQL_PASSWORD=${DB_PASSWORD:-root}
+ healthcheck:
+ test: ['CMD-SHELL', 'pg_isready -U ${DB_USERNAME}', '-d', '${DB_DATABASE:-mediaServer}']
+ interval: 5s
+ timeout: 2s
+ retries: 10
+ networks:
+ - mediaServer-db
volumes:
- db-data:
- driver: local
- shared-env:
- driver: local
+ db-data:
+ driver: local
+ shared-env:
+ driver: local
networks:
- default:
- driver: bridge
- mediaServer-db:
- driver: bridge
+ default:
+ driver: bridge
+ mediaServer-db:
+ driver: bridge
diff --git a/docker/.env.docker b/docker/.env.docker
index 3d3b8256..22354b64 100644
--- a/docker/.env.docker
+++ b/docker/.env.docker
@@ -2,8 +2,8 @@
APP_SCHEME=http # App Protocol -> http OR https -> Should not change
-APP_HOST=app.test # App URL -> Website will be available on https://app.test if you use caddy and http://app.test:8086 otherwise
-APP_PORT=8086 # App Port -> Website will be available on https://app.test if you use caddy and http://app.test:8086 otherwise
+APP_HOST=app.test # App URL -> Website will be available on https://app.test if you use caddy and http://app.test:8080 otherwise
+APP_PORT=8080 # App Port -> Website will be available on https://app.test if you use caddy and http://app.test:8080 otherwise
REVERB_PORT=443 # Websocket Port -> Set to 6001 if you have websocket connection issues
REVERB_SCHEME=https # Websocket Protocol -> http OR https -> Set to HTTPS if you have a valid SSL Certificate for your URL
diff --git a/docker/entrypoint.d/1-keys.sh b/docker/entrypoint.d/1-keys.sh
index 61033817..3d15ece7 100644
--- a/docker/entrypoint.d/1-keys.sh
+++ b/docker/entrypoint.d/1-keys.sh
@@ -1,6 +1,5 @@
#!/bin/bash
-
set -e
if [ -z "$APP_KEY" ] || [ "$APP_KEY" = "base64:" ]; then
@@ -53,21 +52,3 @@ else
fi
php artisan app:manifest
-
-# else
- # php artisan reverb:generate
-
-# echo "Waiting for PostgreSQL to be ready..."
-
-# # Loop until PostgreSQL is ready
-# until PGPASSWORD=$DB_PASSWORD psql -h "$DB_HOST" -U "$DB_USERNAME" -d "$DB_DATABASE" -c "SELECT 1" > /dev/null 2>&1; do
-# echo "PostgreSQL is unavailable - sleeping..."
-# sleep 2
-# done
-
-# php artisan migrate
-
-# Start Supervisor in the background
-# echo "Starting Supervisor..."
-
-# exec "$@"