Added: Dockerfile and docker support

This commit is contained in:
Filip Rojek 2024-12-27 02:29:07 +01:00
parent d9f632da26
commit c4366edb29
4 changed files with 104 additions and 0 deletions

53
.docker/nginx.conf Normal file
View File

@ -0,0 +1,53 @@
# User and worker process settings
user www-data;
worker_processes auto;
pid /run/nginx.pid;
events {
worker_connections 1024;
}
http {
# General settings
sendfile on;
tcp_nopush on;
tcp_nodelay on;
keepalive_timeout 65;
types_hash_max_size 2048;
include /etc/nginx/mime.types;
default_type application/octet-stream;
# Logging
access_log /var/log/nginx/access.log;
error_log /var/log/nginx/error.log;
# Gzip compression
gzip on;
gzip_disable "msie6";
# Server configuration
server {
listen 80;
server_name localhost;
root /var/www/html/public;
index index.php index.html;
location / {
try_files $uri $uri/ /index.php?$query_string;
}
location ~ \\.php$ {
include fastcgi_params;
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
}
location ~ /\.ht {
deny all;
}
}
}

22
.dockerignore Normal file
View File

@ -0,0 +1,22 @@
.git
.gitignore
storage/logs/*
!storage/logs/.gitignore
Dockerfile
docker-compose.yaml
*.swp
*.swo
*.idea/
*.vscode/
*.DS_Store
# Exclude sensitive config files (uncomment if you don't want to include environment config)
# config/environment.php
README.md
TODO.md
LICENSE

18
Dockerfile Normal file
View File

@ -0,0 +1,18 @@
FROM php:8.2-fpm-alpine
WORKDIR /var/www/html
RUN apk add --no-cache nginx curl \
&& docker-php-ext-install mysqli
COPY . /var/www/html
RUN chown -R www-data:www-data /var/www/html \
&& chmod -R 755 /var/www/html
COPY .docker/nginx.conf /etc/nginx/nginx.conf
EXPOSE 80
CMD php-fpm & nginx -g "daemon off;"

View File

@ -14,3 +14,14 @@ services:
- 8080:80 - 8080:80
environment: environment:
- PMA_ARBITRARY=1 - PMA_ARBITRARY=1
habittracker:
build:
context: .
dockerfile: Dockerfile
#volumes:
# - .:/var/www/html
ports:
- 8000:80
depends_on:
- mariadb