From 0e9d6c681fcf829c9236fa71557ffc43bf4484f8 Mon Sep 17 00:00:00 2001 From: Lain Iwakura Date: Thu, 24 Jul 2025 05:17:13 +0300 Subject: [PATCH] gg --- .dockerignore | 8 ++++++++ .gitignore | 1 + Dockerfile | 21 +++++++++++++++++++++ apache.conf | 16 ++++++++++++++++ config.php | 8 ++++---- docker-compose.yml | 34 ++++++++++++++++++++++++++++++++++ uploads/.gitkeep | 1 + 7 files changed, 85 insertions(+), 4 deletions(-) create mode 100644 .dockerignore create mode 100644 .gitignore create mode 100644 Dockerfile create mode 100644 apache.conf create mode 100644 docker-compose.yml create mode 100644 uploads/.gitkeep diff --git a/.dockerignore b/.dockerignore new file mode 100644 index 0000000..e1539f8 --- /dev/null +++ b/.dockerignore @@ -0,0 +1,8 @@ +.git +.gitignore +README +docker-compose.yml +Dockerfile +.dockerignore +uploads/* +!uploads/.gitkeep \ No newline at end of file diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..4f4773f --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +config.php diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..7da51a7 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,21 @@ +FROM php:8.1-apache + +RUN apt-get update && apt-get install -y \ + libpng-dev \ + libjpeg-dev \ + libfreetype6-dev \ + libwebp-dev \ + && docker-php-ext-configure gd --with-freetype --with-jpeg --with-webp \ + && docker-php-ext-install -j$(nproc) gd pdo pdo_mysql + +RUN a2enmod rewrite + +COPY . /var/www/html/ +COPY apache.conf /etc/apache2/sites-available/000-default.conf + +RUN chown -R www-data:www-data /var/www/html \ + && chmod -R 755 /var/www/html/uploads + +EXPOSE 65511 + +CMD ["apache2-foreground"] \ No newline at end of file diff --git a/apache.conf b/apache.conf new file mode 100644 index 0000000..f57e544 --- /dev/null +++ b/apache.conf @@ -0,0 +1,16 @@ + + DocumentRoot /var/www/html + ServerName localhost + + + AllowOverride All + Require all granted + + + + Require all granted + + + ErrorLog ${APACHE_LOG_DIR}/error.log + CustomLog ${APACHE_LOG_DIR}/access.log combined + \ No newline at end of file diff --git a/config.php b/config.php index 9d61563..ccbe5ce 100644 --- a/config.php +++ b/config.php @@ -1,10 +1,10 @@ [ - 'host' => 'localhost', - 'name' => 'mkach', - 'user' => 'mkach', - 'pass' => 'your_password' + 'host' => $_ENV['DB_HOST'] ?? 'mysql', + 'name' => $_ENV['DB_NAME'] ?? 'mkach', + 'user' => $_ENV['DB_USER'] ?? 'mkach', + 'pass' => $_ENV['DB_PASS'] ?? 'mkach' ], 'access_key' => 'mkalwaysthebest1337', 'upload_path' => 'uploads/', diff --git a/docker-compose.yml b/docker-compose.yml new file mode 100644 index 0000000..274edfe --- /dev/null +++ b/docker-compose.yml @@ -0,0 +1,34 @@ +version: '3.8' + +services: + mysql: + image: mysql:8.0 + environment: + MYSQL_ROOT_PASSWORD: root + MYSQL_DATABASE: mkach + MYSQL_USER: mkach + MYSQL_PASSWORD: mkach + ports: + - "3306:3306" + volumes: + - mysql_data:/var/lib/mysql + - ./sql/create.sql:/docker-entrypoint-initdb.d/create.sql + + mkach: + build: . + ports: + - "65511:65511" + depends_on: + - mysql + environment: + - APACHE_RUN_USER=www-data + - APACHE_RUN_GROUP=www-data + - DB_HOST=mysql + - DB_NAME=mkach + - DB_USER=mkach + - DB_PASS=mkach + volumes: + - ./uploads:/var/www/html/uploads + +volumes: + mysql_data: \ No newline at end of file diff --git a/uploads/.gitkeep b/uploads/.gitkeep new file mode 100644 index 0000000..0519ecb --- /dev/null +++ b/uploads/.gitkeep @@ -0,0 +1 @@ + \ No newline at end of file