Update deploy compose and database configuration; adjust Dockerfile for unprivileged user

- Updated environment variable names in compose.deploy.yml for DB and Redis URLs.
- Changed default host, database, and username environment values in database configuration files to be blank.
- Adjusted default ports in deploy compose file and switched to non-root user IDs (33) in Dockerfile for improved security.

Signed-off-by: Nabeel Shahzad <99736+nabeelio@users.noreply.github.com>
This commit is contained in:
Nabeel Shahzad 2026-05-29 16:31:59 -05:00
parent c143f99715
commit 793de2c0e8
No known key found for this signature in database
GPG Key ID: 08C44114D2BF3047
3 changed files with 16 additions and 14 deletions

View File

@ -31,8 +31,9 @@ RUN bun install && bun run build
FROM serversideup/php:8.5-frankenphp
ARG WWWUSER=1000
ARG WWWGROUP=1000
# https://serversideup.net/open-source/docker-php/docs/getting-started/default-configurations
ARG WWWUSER=33
ARG WWWGROUP=33
# Switch to root so we can do root things
USER root

View File

@ -68,8 +68,8 @@ services:
XDG_CONFIG_HOME: "/var/www/html/storage"
# Uncomment these lines if you're using MariaDB or Redis in this compose
DB_URL: "${DB_URI}"
REDIS_URL: "${REDIS_URI}"
DB_URL: "${DB_URL}"
REDIS_URL: "${REDIS_URL}"
# Delete this line to revert to classic FrankenPHP + PHP-worker mode.
command:
@ -84,11 +84,12 @@ services:
]
ports:
# The image binds to 8000/8443 internally (unprivileged); host ports
# 80/443 are mapped at the Compose layer.
- "${FORWARD_HTTP_PORT:-8000}:8000"
# 8000/8443 are mapped at the Compose layer.
- "${FORWARD_HTTP_PORT:-8080}:8080"
- "${FORWARD_HTTPS_PORT:-8443}:8443"
user: "${WWWUSER:-1000}:${WWWGROUP:-1000}"
# UIDs and GIDs of the serversideup images
user: "${WWWUSER:-33}:${WWWGROUP:-33}"
env_file:
- .env
volumes:

View File

@ -25,10 +25,10 @@ return [
'mysql' => [
'driver' => 'mysql',
'url' => env('DB_URL'),
'host' => env('DB_HOST', '127.0.0.1'),
'host' => env('DB_HOST', ''),
'port' => env('DB_PORT', '3306'),
'database' => env('DB_DATABASE', 'laravel'),
'username' => env('DB_USERNAME', 'root'),
'database' => env('DB_DATABASE', ''),
'username' => env('DB_USERNAME', ''),
'password' => env('DB_PASSWORD', ''),
'unix_socket' => env('DB_SOCKET', ''),
'charset' => env('DB_CHARSET', 'utf8mb4'),
@ -46,10 +46,10 @@ return [
'mariadb' => [
'driver' => 'mariadb',
'url' => env('DB_URL'),
'host' => env('DB_HOST', '127.0.0.1'),
'port' => env('DB_PORT', '3306'),
'database' => env('DB_DATABASE', 'laravel'),
'username' => env('DB_USERNAME', 'root'),
'host' => env('DB_HOST', ''),
'port' => env('DB_PORT', ''),
'database' => env('DB_DATABASE', ''),
'username' => env('DB_USERNAME', ''),
'password' => env('DB_PASSWORD', ''),
'unix_socket' => env('DB_SOCKET', ''),
'charset' => env('DB_CHARSET', 'utf8mb4'),