diff --git a/.docker/nginx.conf b/.docker/nginx.conf new file mode 100644 index 0000000..76c5f9c --- /dev/null +++ b/.docker/nginx.conf @@ -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; + } + } +} + diff --git a/.dockerignore b/.dockerignore new file mode 100644 index 0000000..3cdec24 --- /dev/null +++ b/.dockerignore @@ -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 + diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..e806b13 --- /dev/null +++ b/Dockerfile @@ -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;" + diff --git a/docker-compose.yaml b/docker-compose.yaml index bb5365b..249de3a 100644 --- a/docker-compose.yaml +++ b/docker-compose.yaml @@ -14,3 +14,14 @@ services: - 8080:80 environment: - PMA_ARBITRARY=1 + + habittracker: + build: + context: . + dockerfile: Dockerfile + #volumes: + # - .:/var/www/html + ports: + - 8000:80 + depends_on: + - mariadb