added docker files and update roster form

This commit is contained in:
franknstayn
2023-09-04 23:22:33 +08:00
parent 006169a8b7
commit adf50d9d69
8 changed files with 96 additions and 60 deletions

View File

@@ -15,17 +15,15 @@ RUN apk --update --no-cache add \
&& docker-php-ext-install gd pdo pdo_mysql zip mcrypt
# Set the working directory in the container
WORKDIR /var/www/html
WORKDIR /var/www
# Copy Nginx config
COPY default.conf /etc/nginx/conf.d/default.conf
COPY entrypoint.sh /etc/entrypoint.sh
RUN chmod +x /etc/entrypoint.sh
RUN mkdir -p /run/nginx
# Clear cache
# RUN apt-get clean && rm -rf /var/lib/apt/lists/*
# Copy the Laravel application files to the container
COPY . .
# Set appropriate permissions for Laravel storage and bootstrap cache
RUN chown -R www-data:www-data storage bootstrap
@@ -33,7 +31,7 @@ RUN chown -R www-data:www-data storage bootstrap
RUN curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer
# Install Laravel dependencies
RUN composer install
RUN composer install --no-plugins --no-scripts
# Generate Laravel application key
RUN php artisan key:generate
@@ -44,9 +42,6 @@ RUN mkdir -p /run/php && chown www-data:www-data /run/php
# Copy the www.conf file to PHP-FPM pool.d directory
COPY www.conf /usr/local/etc/php-fpm.d/www.conf
# Expose port 9000 for PHP-FPM
EXPOSE 80
EXPOSE 9001
# Start PHP-FPM
ENTRYPOINT ["/etc/entrypoint.sh"]
# Expose port 9000 and start php-fpm server
EXPOSE 9000
CMD ["php-fpm"]

View File

@@ -1,27 +0,0 @@
server {
listen 80;
server_name localhost;
root /var/www/html;
index index.php index.html;
location / {
try_files $uri $uri/ /index.php?$query_string;
}
location ~ \.php {
fastcgi_index index.php;
fastcgi_pass unix:/run/php-fpm.sock;
include fastcgi_params;
fastcgi_split_path_info ^(.+\.php)(/.+)$;
fastcgi_param PATH_INFO $fastcgi_path_info;
fastcgi_param PATH_TRANSLATED $document_root$fastcgi_path_info;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
}
location ~* \.(css|less|js|jpg|png|gif)$ {
add_header Cache-Control "no-cache, no-store, must-revalidate";
add_header Pragma "no-cache";
expires 0;
}
}

45
docker-compose.yml Normal file
View File

@@ -0,0 +1,45 @@
version: '3'
services:
#PHP Service
app:
build:
context: .
dockerfile: Dockerfile
image: digitalocean.com/php
container_name: app
restart: unless-stopped
tty: true
environment:
SERVICE_NAME: app
SERVICE_TAGS: dev
working_dir: /var/www
volumes:
- ./:/var/www
- ./php/local.ini:/usr/local/etc/php/conf.d/local.ini
networks:
- app-network
#Nginx Service
webserver:
image: nginx:alpine
container_name: webserver
restart: unless-stopped
tty: true
ports:
- "9091:80"
- "443:443"
volumes:
- ./:/var/www
- ./nginx/conf.d/:/etc/nginx/conf.d/
networks:
- app-network
#Docker Networks
networks:
app-network:
driver: bridge
#Volumes
volumes:
dbdata:
driver: local

View File

@@ -1,5 +0,0 @@
#!/usr/bin/env sh
set -e
php-fpm -D
nginx -g 'daemon off;'

39
nginx/conf.d/app.conf Normal file
View File

@@ -0,0 +1,39 @@
server {
listen 80;
index index.php index.html;
error_log /var/log/nginx/error.log;
access_log /var/log/nginx/access.log;
root /var/www;
index index.php index.html;
location / {
if ($request_method = 'OPTIONS') {
add_header 'Access-Control-Allow-Origin' '*';
add_header 'Access-Control-Allow-Methods' 'GET, POST, OPTIONS, PUT, DELETE, HEAD';
add_header 'Access-Control-Max-Age' '1728000';
add_header 'Access-Control-Allow-Headers' '*';
#add_header 'Content-Type: text/plain; charset=UTF-8';
#add_header 'Content-Length: 0';
return 204;
}
try_files $uri $uri/ /index.php?$query_string;
}
location ~ \.php$ {
fastcgi_index index.php;
fastcgi_pass app:9000;
include fastcgi_params;
fastcgi_split_path_info ^(.+\.php)(/.+)$;
fastcgi_param PATH_INFO $fastcgi_path_info;
fastcgi_param PATH_TRANSLATED $document_root$fastcgi_path_info;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
}
location ~* \.(css|less|js|jpg|png|gif)$ {
add_header Cache-Control "no-cache, no-store, must-revalidate";
add_header Pragma "no-cache";
expires 0;
}
}

2
php/local.ini Normal file
View File

@@ -0,0 +1,2 @@
upload_max_filesize=40M
post_max_size=40M

View File

@@ -15,6 +15,7 @@
<!-- <input type="text" name="order_names[]" id="order_names" class="form-control input-sm inputName roster-input" placeholder="Name"> -->
<select class="form-control input-sm select-name" id="order_names" name="order_names[]">
<!-- <option value="none">none</option> -->
<option value="">Select Player</option>
@foreach($roster as $ros)
<option value="{{ $ros->Name }}" data-number="{{ $ros->Number }}">{{ $ros->Name }} - {{ $ros->Number }}</option>
@endforeach
@@ -33,6 +34,7 @@
<!-- </td> -->
<td class="w-50">
<select class="form-control input-sm order-size roster-input" name="order_size[]" style="border-right: 1px solid #ccc;" data-row-number="1">
<option value="">Select Size</option>
@foreach($sizes_array as $size)
<option value="{{ $size->Size }}">{{ $size->SizeDisplay }}</option>
@endforeach

View File

@@ -1,15 +0,0 @@
; www.conf
[www]
listen = /run/php-fpm.sock
listen.owner = www-data
listen.group = www-data
listen.mode = 0660
user = www-data
group = www-data
pm = dynamic ; You can choose 'static', 'dynamic', or 'ondemand'
pm.max_children = 5 ; Adjust as needed
pm.start_servers = 2 ; Adjust as needed
pm.min_spare_servers = 1 ; Adjust as needed
pm.max_spare_servers = 3 ; Adjust as needed