mirror of
https://github.com/usetrmnl/byos_laravel.git
synced 2026-01-13 23:18:10 +00:00
docker: update to serversideup non priviledged container
This commit is contained in:
parent
8a5a813540
commit
a6eb2f6101
6 changed files with 40 additions and 113 deletions
36
Dockerfile
36
Dockerfile
|
|
@ -1,37 +1,29 @@
|
||||||
FROM bnussbau/php:8.3-fpm-opcache-imagick-puppeteer-alpine3.20
|
FROM bnussbau/serversideup-php:8.3-fpm-nginx-alpine-imagick-chromium
|
||||||
|
|
||||||
# Install composer
|
USER www-data
|
||||||
COPY --from=composer:latest /usr/bin/composer /usr/bin/composer
|
|
||||||
|
|
||||||
# Set working directory
|
# Set working directory
|
||||||
WORKDIR /var/www/html
|
WORKDIR /var/www/html
|
||||||
|
|
||||||
# Copy configuration files
|
|
||||||
COPY docker/nginx.conf /etc/nginx/http.d/default.conf
|
|
||||||
COPY docker/supervisord.conf /etc/supervisor/conf.d/supervisord.conf
|
|
||||||
COPY docker/php.ini /usr/local/etc/php/conf.d/custom.ini
|
|
||||||
|
|
||||||
# Create required directories
|
# Create required directories
|
||||||
RUN mkdir -p /var/log/supervisor \
|
RUN mkdir -p storage/logs \
|
||||||
&& mkdir -p storage/logs \
|
|
||||||
&& mkdir -p storage/framework/{cache,sessions,views} \
|
&& mkdir -p storage/framework/{cache,sessions,views} \
|
||||||
&& chmod -R 775 storage \
|
|
||||||
&& mkdir -p bootstrap/cache \
|
&& mkdir -p bootstrap/cache \
|
||||||
&& chmod -R 775 bootstrap/cache \
|
&& mkdir -p database
|
||||||
&& mkdir -p database \
|
|
||||||
&& touch database/database.sqlite \
|
|
||||||
&& chmod -R 777 database
|
|
||||||
|
|
||||||
# Copy application files
|
|
||||||
COPY --chown=www-data:www-data . .
|
|
||||||
COPY --chown=www-data:www-data ./.env.example ./.env
|
COPY --chown=www-data:www-data ./.env.example ./.env
|
||||||
|
|
||||||
# Install application dependencies
|
# Install application dependencies
|
||||||
|
COPY --chown=www-data:www-data composer.json composer.lock ./
|
||||||
RUN composer install --no-interaction --prefer-dist --optimize-autoloader
|
RUN composer install --no-interaction --prefer-dist --optimize-autoloader
|
||||||
RUN npm ci && npm run build
|
|
||||||
|
|
||||||
|
COPY --chown=www-data:www-data package.json package-lock.json ./
|
||||||
|
RUN npm ci
|
||||||
|
|
||||||
|
# Copy application files
|
||||||
|
COPY --chown=www-data:www-data . .
|
||||||
|
RUN npm run build
|
||||||
|
|
||||||
|
ENV AUTORUN_ENABLED=true
|
||||||
# Expose port 80
|
# Expose port 80
|
||||||
EXPOSE 80
|
EXPOSE 8080
|
||||||
|
|
||||||
# Start supervisor
|
|
||||||
CMD ["/usr/bin/supervisord", "-n", "-c", "/etc/supervisor/conf.d/supervisord.conf"]
|
|
||||||
|
|
|
||||||
|
|
@ -4,12 +4,17 @@ services:
|
||||||
context: .
|
context: .
|
||||||
dockerfile: Dockerfile
|
dockerfile: Dockerfile
|
||||||
ports:
|
ports:
|
||||||
- "4567:80"
|
- "4567:8080"
|
||||||
environment:
|
environment:
|
||||||
#- APP_KEY=
|
#- APP_KEY=
|
||||||
|
- PHP_OPCACHE_ENABLE=1
|
||||||
- TRMNL_PROXY_REFRESH_MINUTES=15
|
- TRMNL_PROXY_REFRESH_MINUTES=15
|
||||||
# volumes:
|
volumes:
|
||||||
# - ./database/database.sqlite:/var/www/html/database/database.sqlite
|
- database:/var/www/html/database/
|
||||||
# - ./storage:/var/www/html/storage
|
- storage:/var/www/html/storage
|
||||||
restart: unless-stopped
|
restart: unless-stopped
|
||||||
#platform: "linux/arm64/v8"
|
#platform: "linux/arm64/v8"
|
||||||
|
volumes:
|
||||||
|
database:
|
||||||
|
storage:
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,17 +0,0 @@
|
||||||
server {
|
|
||||||
listen 80;
|
|
||||||
server_name _;
|
|
||||||
root /var/www/html/public;
|
|
||||||
index index.php;
|
|
||||||
|
|
||||||
location / {
|
|
||||||
try_files $uri $uri/ /index.php?$query_string;
|
|
||||||
}
|
|
||||||
|
|
||||||
location ~ \.php$ {
|
|
||||||
fastcgi_pass 127.0.0.1:9000;
|
|
||||||
fastcgi_index index.php;
|
|
||||||
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
|
|
||||||
include fastcgi_params;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -1,14 +0,0 @@
|
||||||
[PHP]
|
|
||||||
memory_limit = 256M
|
|
||||||
max_execution_time = 60
|
|
||||||
upload_max_filesize = 50M
|
|
||||||
post_max_size = 50M
|
|
||||||
|
|
||||||
[opcache]
|
|
||||||
opcache.enable=1
|
|
||||||
opcache.memory_consumption=128
|
|
||||||
opcache.interned_strings_buffer=8
|
|
||||||
opcache.max_accelerated_files=4000
|
|
||||||
opcache.revalidate_freq=60
|
|
||||||
opcache.fast_shutdown=1
|
|
||||||
opcache.enable_cli=1
|
|
||||||
17
docker/prod/docker-compose.yml
Normal file
17
docker/prod/docker-compose.yml
Normal file
|
|
@ -0,0 +1,17 @@
|
||||||
|
services:
|
||||||
|
app:
|
||||||
|
image: ghcr.io/usetrmnl/byos_laravel:latest
|
||||||
|
ports:
|
||||||
|
- "4567:8080"
|
||||||
|
environment:
|
||||||
|
#- APP_KEY=
|
||||||
|
- PHP_OPCACHE_ENABLE=1
|
||||||
|
- TRMNL_PROXY_REFRESH_MINUTES=15
|
||||||
|
volumes:
|
||||||
|
- database:/var/www/html/database/
|
||||||
|
- storage:/var/www/html/storage
|
||||||
|
restart: unless-stopped
|
||||||
|
volumes:
|
||||||
|
database:
|
||||||
|
storage:
|
||||||
|
|
||||||
|
|
@ -1,56 +0,0 @@
|
||||||
[supervisord]
|
|
||||||
nodaemon=true
|
|
||||||
user=root
|
|
||||||
logfile=/var/log/supervisor/supervisord.log
|
|
||||||
pidfile=/var/run/supervisord.pid
|
|
||||||
|
|
||||||
[program:php-fpm]
|
|
||||||
command=php-fpm
|
|
||||||
stdout_logfile=/dev/stdout
|
|
||||||
stdout_logfile_maxbytes=0
|
|
||||||
stderr_logfile=/dev/stderr
|
|
||||||
stderr_logfile_maxbytes=0
|
|
||||||
|
|
||||||
[program:nginx]
|
|
||||||
command=nginx -g 'daemon off;'
|
|
||||||
stdout_logfile=/dev/stdout
|
|
||||||
stdout_logfile_maxbytes=0
|
|
||||||
stderr_logfile=/dev/stderr
|
|
||||||
stderr_logfile_maxbytes=0
|
|
||||||
|
|
||||||
[program:laravel-queue]
|
|
||||||
command=php /var/www/html/artisan queue:work
|
|
||||||
autostart=true
|
|
||||||
autorestart=true
|
|
||||||
stdout_logfile=/dev/stdout
|
|
||||||
stdout_logfile_maxbytes=0
|
|
||||||
stderr_logfile=/dev/stderr
|
|
||||||
stderr_logfile_maxbytes=0
|
|
||||||
stopwaitsecs=3600
|
|
||||||
|
|
||||||
[program:laravel-scheduler]
|
|
||||||
command=php /var/www/html/artisan schedule:work
|
|
||||||
autostart=true
|
|
||||||
autorestart=true
|
|
||||||
stdout_logfile=/dev/stdout
|
|
||||||
stdout_logfile_maxbytes=0
|
|
||||||
stderr_logfile=/dev/stderr
|
|
||||||
stderr_logfile_maxbytes=0
|
|
||||||
|
|
||||||
[program:laravel-setup]
|
|
||||||
command=/bin/sh -c "php /var/www/html/artisan storage:link >> /tmp/storage-link.done"
|
|
||||||
autostart=true
|
|
||||||
autorestart=false
|
|
||||||
startsecs=0
|
|
||||||
exitcodes=0
|
|
||||||
stdout_logfile=/dev/stdout
|
|
||||||
stderr_logfile=/dev/stderr
|
|
||||||
|
|
||||||
[program:laravel-db-migrate]
|
|
||||||
command=/bin/sh -c "php /var/www/html/artisan migrate --force >> /tmp/migrate.done"
|
|
||||||
autostart=true
|
|
||||||
autorestart=false
|
|
||||||
startsecs=0
|
|
||||||
exitcodes=0
|
|
||||||
stdout_logfile=/dev/stdout
|
|
||||||
stderr_logfile=/dev/stderr
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue