Docker commit
This commit is contained in:
parent
2bfa1de120
commit
d3fabd72e8
64
Docker/nginx/nginx.conf
Normal file
64
Docker/nginx/nginx.conf
Normal file
@ -0,0 +1,64 @@
|
||||
server {
|
||||
listen 80;
|
||||
server_name _;
|
||||
root /var/www/holos.backend/public;
|
||||
index index.php index.html;
|
||||
|
||||
# Logging
|
||||
error_log /var/log/nginx/error.log;
|
||||
access_log /var/log/nginx/access.log;
|
||||
|
||||
# Gzip compression
|
||||
gzip on;
|
||||
gzip_types text/plain text/css application/json application/javascript text/xml application/xml application/xml+rss text/javascript;
|
||||
|
||||
# Security headers
|
||||
add_header X-Frame-Options "SAMEORIGIN";
|
||||
add_header X-Content-Type-Options "nosniff";
|
||||
|
||||
# Handle Laravel routes
|
||||
location / {
|
||||
try_files $uri $uri/ /index.php?$query_string;
|
||||
}
|
||||
|
||||
# Handle PHP files
|
||||
location ~ \.php$ {
|
||||
try_files $uri =404;
|
||||
fastcgi_split_path_info ^(.+\.php)(/.+)$;
|
||||
fastcgi_pass holos-backend:9000; # Nombre del servicio en docker-compose
|
||||
fastcgi_index index.php;
|
||||
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
|
||||
fastcgi_param PATH_INFO $fastcgi_path_info;
|
||||
include fastcgi_params;
|
||||
|
||||
# Timeouts para requests largos
|
||||
fastcgi_read_timeout 300;
|
||||
fastcgi_send_timeout 300;
|
||||
}
|
||||
|
||||
# Handle static files with caching
|
||||
location ~* \.(jpg|jpeg|png|gif|ico|css|js|pdf|txt|tar|woff|woff2|ttf|svg|eot)$ {
|
||||
expires 1y;
|
||||
add_header Cache-Control "public, immutable";
|
||||
try_files $uri =404;
|
||||
}
|
||||
|
||||
# Handle storage files (Laravel storage link)
|
||||
location /storage {
|
||||
alias /var/www/holos.backend/storage/app/public;
|
||||
try_files $uri =404;
|
||||
}
|
||||
|
||||
# Handle profile images
|
||||
location /profile {
|
||||
alias /var/www/holos.backend/storage/app/profile;
|
||||
try_files $uri =404;
|
||||
}
|
||||
|
||||
# Handle images
|
||||
location /images {
|
||||
alias /var/www/holos.backend/storage/app/images;
|
||||
try_files $uri =404;
|
||||
}
|
||||
|
||||
}
|
||||
66
docker-compose.yml
Normal file
66
docker-compose.yml
Normal file
@ -0,0 +1,66 @@
|
||||
services:
|
||||
holos-backend:
|
||||
build:
|
||||
context: .
|
||||
dockerfile: dockerfile
|
||||
working_dir: /var/www/holos.backend
|
||||
volumes:
|
||||
- ./:/var/www/holos.backend
|
||||
- ./storage:/var/www/holos.backend/storage
|
||||
networks:
|
||||
- holos-network
|
||||
depends_on:
|
||||
- mysql
|
||||
- redis
|
||||
|
||||
nginx:
|
||||
image: nginx:alpine
|
||||
ports:
|
||||
- "8080:80"
|
||||
volumes:
|
||||
- ./:/var/www/holos.backend
|
||||
- ./Docker/nginx/nginx.conf:/etc/nginx/conf.d/default.conf
|
||||
networks:
|
||||
- holos-network
|
||||
depends_on:
|
||||
- holos-backend
|
||||
|
||||
mysql:
|
||||
image: mysql:8.0
|
||||
environment:
|
||||
MYSQL_DATABASE: ${DB_DATABASE}
|
||||
MYSQL_ROOT_PASSWORD: ${DB_PASSWORD}
|
||||
MYSQL_PASSWORD: ${DB_PASSWORD}
|
||||
MYSQL_USER: ${DB_USERNAME}
|
||||
ports:
|
||||
- "3306:3306"
|
||||
volumes:
|
||||
- mysql_data:/var/lib/mysql
|
||||
networks:
|
||||
- holos-network
|
||||
|
||||
phpmyadmin:
|
||||
image: phpmyadmin/phpmyadmin
|
||||
environment:
|
||||
PMA_HOST: mysql
|
||||
PMA_PORT: 3306
|
||||
ports:
|
||||
- '8081:80'
|
||||
depends_on:
|
||||
- mysql
|
||||
networks:
|
||||
- holos-network
|
||||
|
||||
redis:
|
||||
image: redis:alpine
|
||||
ports:
|
||||
- "6379:6379"
|
||||
networks:
|
||||
- holos-network
|
||||
|
||||
volumes:
|
||||
mysql_data:
|
||||
|
||||
networks:
|
||||
holos-network:
|
||||
driver: bridge
|
||||
35
dockerfile
Normal file
35
dockerfile
Normal file
@ -0,0 +1,35 @@
|
||||
FROM php:8.3-fpm
|
||||
|
||||
RUN mkdir -p /var/www/holos.backend
|
||||
|
||||
RUN apt-get update && apt-get install -y\
|
||||
git \
|
||||
curl \
|
||||
libpng-dev \
|
||||
libonig-dev \
|
||||
libxml2-dev \
|
||||
zip \
|
||||
unzip \
|
||||
libzip-dev \
|
||||
&& curl -fsSL https://deb.nodesource.com/setup_18.x | bash - \
|
||||
&& apt-get install -y nodejs
|
||||
|
||||
RUN docker-php-ext-install pdo_mysql mbstring exif pcntl bcmath gd zip
|
||||
|
||||
COPY --from=composer:latest /usr/bin/composer /usr/bin/composer
|
||||
|
||||
WORKDIR /var/www/holos.backend
|
||||
|
||||
COPY composer.json composer.lock package*.json ./
|
||||
|
||||
RUN composer install --no-dev --no-scripts --no-autoloader --optimize-autoloader --no-interaction
|
||||
|
||||
COPY . .
|
||||
|
||||
RUN chown -R www-data:www-data /var/www/holos.backend \
|
||||
&& chmod -R 755 /var/www/holos.backend/storage \
|
||||
&& chmod -R 755 /var/www/holos.backend/bootstrap/cache
|
||||
|
||||
EXPOSE 9000
|
||||
|
||||
CMD ["php-fpm"]
|
||||
Loading…
x
Reference in New Issue
Block a user