Docker updates

This commit is contained in:
Joey Kimsey
2024-08-14 17:41:15 -04:00
parent 156f19ee97
commit b6767ae846
11 changed files with 191 additions and 139 deletions

View File

@ -0,0 +1,29 @@
FROM php:8-fpm as php-fpm
# Env
ENV COMPOSER_ALLOW_SUPERUSER=1
# Install Packages
RUN apt-get update -y
RUN apt-get install -y nginx libmariadb-dev git libzip-dev zip unzip supervisor
RUN docker-php-ext-install mysqli pdo pdo_mysql zip
# Install Composer
COPY --from=composer:latest /usr/bin/composer /usr/bin/composer
#Install TTP
WORKDIR /var/www
RUN rm -rf html/
RUN composer create-project thetempusproject/thetempusproject html
RUN chmod -R 777 html/
RUN chown -R www-data:www-data html/
# Copy Nginx configuration file
RUN cp /etc/nginx/nginx.conf /etc/nginx/nginx.conf.old
COPY ./docker/ttp-nginx/nginx.conf /etc/nginx/nginx.conf
# Copy Supervisor configuration file
COPY ./docker/ttp-nginx/supervisord.conf /etc/supervisor/conf.d/supervisord.conf
# Start Supervisor, which will start both Nginx and PHP-FPM
CMD ["/usr/bin/supervisord", "-c", "/etc/supervisor/conf.d/supervisord.conf"]

View File

@ -0,0 +1,19 @@
Build the image
```
docker build -t thetempusproject/ttp-nginx:latest .
docker build --no-cache -t thetempusproject/ttp-nginx:latest .
```
Set the proper tag for dockerhub
```
docker tag ttp-nginx:latest thetempusproject/ttp-nginx:latest
```
Run the image
```
docker run -d -p 8000:80 thetempusproject/ttp-nginx
```

View File

@ -0,0 +1,90 @@
user www-data;
worker_processes auto;
pid /run/nginx.pid;
error_log /var/log/nginx/error.log;
include /etc/nginx/modules-enabled/*.conf;
events {
worker_connections 768;
}
http {
tcp_nopush on;
types_hash_max_size 2048;
include /etc/nginx/mime.types;
default_type application/octet-stream;
ssl_protocols TLSv1 TLSv1.1 TLSv1.2 TLSv1.3; # Dropping SSLv3, ref: POODLE
ssl_prefer_server_ciphers on;
access_log /var/log/nginx/access.log;
gzip on;
server {
listen 80 default_server;
index index.php;
server_name TheTempusProject;
root /var/www/html;
charset utf-8;
sendfile on;
client_max_body_size 100m;
location /js/ {
access_log off;
log_not_found off;
try_files $uri /index.php?error=js404&file=$uri;
}
location /css/ {
try_files $uri /index.php?error=css404&file=$uri;
}
location /images/ {
try_files $uri /index.php?error=image404&url=$uri;
}
location /uploads/ {
try_files $uri /index.php?error=upload404&url=$uri;
}
location /errors/ {
try_files $uri /index.php?error=$uri;
}
location = /favicon.ico {
access_log off;
log_not_found off;
rewrite ^(.+)$ /images/favicon.ico break;
}
location = /robots.txt {
allow all;
access_log off;
log_not_found off;
rewrite ^(.+)$ /bin/robots.txt break;
}
location ~* \.(?:js|css|png|jpg|gif|ico)$ {
access_log off;
log_not_found off;
}
location ~ \.php$ {
fastcgi_pass 127.0.0.1:9000;
include snippets/fastcgi-php.conf;
include fastcgi_params;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_intercept_errors off;
fastcgi_buffer_size 16k;
fastcgi_buffers 4 16k;
fastcgi_connect_timeout 60s;
fastcgi_read_timeout 60s;
fastcgi_send_timeout 60s;
}
location / {
rewrite ^/(.+)$ /index.php?url=$1&$args last;
}
}
include /etc/nginx/conf.d/*.conf;
}

View File

@ -0,0 +1,8 @@
[supervisord]
nodaemon=true
[program:php-fpm]
command=/usr/local/sbin/php-fpm
[program:nginx]
command=/usr/sbin/nginx -g 'daemon off;'