From 509080a62bfdf1d83137c38b3145f960fbbfafa9 Mon Sep 17 00:00:00 2001 From: weeb Date: Fri, 2 May 2025 13:26:53 +0200 Subject: [PATCH] Add docker support --- Dockerfile | 48 ++++++++++++++++++++++++++++++++++++++++++++++ docker-compose.yml | 26 +++++++++++++++++++++++++ nginx/default.conf | 20 +++++++++++++++++++ 3 files changed, 94 insertions(+) create mode 100644 Dockerfile create mode 100644 docker-compose.yml create mode 100644 nginx/default.conf diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..d2c9d71 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,48 @@ +FROM php:8.4-fpm + +ARG user +ARG uid + +# Install system dependencies +RUN apt-get update && apt-get install -y --no-install-recommends \ + git \ + curl \ + zip \ + unzip \ + sqlite3 \ + libpng-dev \ + libjpeg-dev \ + libzip-dev \ + libonig-dev \ + libxml2-dev \ + libsqlite3-dev \ + libfreetype6-dev \ + libonig-dev \ + libicu-dev \ + build-essential \ + openssl + +# Install PHP extensions +RUN docker-php-ext-configure gd --enable-gd --with-freetype --with-jpeg +RUN docker-php-ext-install gd \ + pdo \ + pdo_sqlite \ + mbstring \ + zip \ + exif \ + bcmath \ + intl \ + fileinfo + +# Install Node.js (LTS version) and npm +RUN curl -fsSL https://deb.nodesource.com/setup_22.x | bash - \ + && apt-get install -y nodejs + +# Clean up +RUN apt-get clean && rm -rf /var/lib/apt/lists/* + +# Get latest Composer +RUN curl -sS https://getcomposer.org/installer | php -- \ + --install-dir=/usr/local/bin --filename=composer + +WORKDIR /var/www diff --git a/docker-compose.yml b/docker-compose.yml new file mode 100644 index 0000000..134a623 --- /dev/null +++ b/docker-compose.yml @@ -0,0 +1,26 @@ +services: + app: + build: . + container_name: lolispace_applications + working_dir: /var/www + volumes: + - ./:/var/www + networks: + - lolispace_applications_bridge + + webserver: + image: nginx:alpine + container_name: lolispace_webserver + ports: + - "8080:80" + volumes: + - ./:/var/www + - ./nginx/default.conf:/etc/nginx/conf.d/default.conf + depends_on: + - app + networks: + - lolispace_applications_bridge + +networks: + lolispace_applications_bridge: + driver: bridge diff --git a/nginx/default.conf b/nginx/default.conf new file mode 100644 index 0000000..c63f01e --- /dev/null +++ b/nginx/default.conf @@ -0,0 +1,20 @@ +server { + listen 80; + index index.php index.html; + root /var/www/public; + + location / { + try_files $uri $uri/ /index.php?$query_string; + } + + location ~ \.php$ { + fastcgi_pass app:9000; + fastcgi_index index.php; + fastcgi_param SCRIPT_FILENAME $realpath_root$fastcgi_script_name; + include fastcgi_params; + } + + location ~ /\.ht { + deny all; + } +}