mirror of
https://github.com/alextselegidis/plainpad.git
synced 2024-10-05 14:37:29 +03:00
Update the docker compose set up
This commit is contained in:
parent
cc9a89510f
commit
22fa006a2f
3
.gitignore
vendored
3
.gitignore
vendored
@ -1,4 +1,5 @@
|
||||
/.idea
|
||||
/build
|
||||
/docker/mysql
|
||||
/docker/mysql/*
|
||||
!/docker/mysql/.gitkeep
|
||||
.DS_Store
|
||||
|
47
docker-compose.yml
Normal file
47
docker-compose.yml
Normal file
@ -0,0 +1,47 @@
|
||||
version: '3.1'
|
||||
services:
|
||||
php-fpm:
|
||||
build: docker/php-fpm
|
||||
working_dir: /var/www/html
|
||||
extra_hosts:
|
||||
- host.docker.internal:host-gateway
|
||||
volumes:
|
||||
- '.:/var/www/html'
|
||||
- './docker/php-fpm/php-ini-overrides.ini:/usr/local/etc/php/conf.d/99-overrides.ini'
|
||||
ports:
|
||||
- '3000:3000'
|
||||
|
||||
nginx:
|
||||
image: 'nginx:1.23.3-alpine'
|
||||
working_dir: /var/www/html
|
||||
volumes:
|
||||
- '.:/var/www/html'
|
||||
- './docker/nginx/nginx.conf:/etc/nginx/conf.d/default.conf'
|
||||
ports:
|
||||
- '80:80'
|
||||
|
||||
mysql:
|
||||
image: 'mysql:8.0'
|
||||
volumes:
|
||||
- './docker/mysql:/var/lib/mysql'
|
||||
environment:
|
||||
- MYSQL_ROOT_PASSWORD=secret
|
||||
- MYSQL_DATABASE=plainpad
|
||||
- MYSQL_USER=user
|
||||
- MYSQL_PASSWORD=password
|
||||
ports:
|
||||
- '3306:3306'
|
||||
|
||||
phpmyadmin:
|
||||
image: 'phpmyadmin:5.2.1'
|
||||
ports:
|
||||
- '8080:80'
|
||||
environment:
|
||||
- 'PMA_HOST=mysql'
|
||||
|
||||
mailpit:
|
||||
image: 'axllent/mailpit:v1.7'
|
||||
ports:
|
||||
- '8025:8025'
|
||||
- '1025:1025'
|
||||
|
@ -1,21 +0,0 @@
|
||||
version: "3.1"
|
||||
services:
|
||||
mysql:
|
||||
image: mysql:5.7
|
||||
container_name: plainpad-database
|
||||
volumes:
|
||||
- ./mysql:/var/lib/mysql
|
||||
environment:
|
||||
- MYSQL_ROOT_PASSWORD=root
|
||||
- MYSQL_DATABASE=plainpad
|
||||
ports:
|
||||
- "8001:3306"
|
||||
server:
|
||||
build: ./server
|
||||
image: plainpad-server:v1
|
||||
container_name: plainpad-server
|
||||
ports:
|
||||
- "8000:80"
|
||||
volumes:
|
||||
- ../server:/var/www/html
|
||||
- ./server/php.ini:/usr/local/etc/php/conf.d/99-overrides.ini
|
0
docker/mysql/.gitkeep
Normal file
0
docker/mysql/.gitkeep
Normal file
51
docker/nginx/nginx.conf
Normal file
51
docker/nginx/nginx.conf
Normal file
@ -0,0 +1,51 @@
|
||||
server {
|
||||
listen 80 default;
|
||||
|
||||
server_name localhost;
|
||||
|
||||
client_max_body_size 108M;
|
||||
|
||||
access_log /var/log/nginx/application.access.log;
|
||||
|
||||
root /var/www/html;
|
||||
|
||||
index index.php index.html;
|
||||
|
||||
# Map all PHP requests towards the API.
|
||||
|
||||
location /api.php/ {
|
||||
root /var/www/html/server/public/;
|
||||
fastcgi_pass php-fpm:9000;
|
||||
fastcgi_split_path_info ^(.+\.php)(/.+)$;
|
||||
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
|
||||
fastcgi_param PHP_VALUE "error_log=/var/log/nginx/application_php_errors.log";
|
||||
fastcgi_buffers 16 16k;
|
||||
fastcgi_buffer_size 32k;
|
||||
fastcgi_index index.php;
|
||||
include fastcgi_params;
|
||||
}
|
||||
|
||||
# Reverse proxy the CRA app.
|
||||
|
||||
location / {
|
||||
proxy_pass http://php-fpm:3000;
|
||||
proxy_redirect off;
|
||||
proxy_set_header Host $host;
|
||||
proxy_set_header X-Real-IP $remote_addr;
|
||||
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
||||
proxy_set_header X-Forwarded-Host $server_name;
|
||||
}
|
||||
|
||||
# Reverse proxy the CRA web sockets.
|
||||
|
||||
location /ws {
|
||||
proxy_pass http://php-fpm:3000;
|
||||
proxy_http_version 1.1;
|
||||
proxy_set_header Upgrade $http_upgrade;
|
||||
proxy_set_header Connection "Upgrade";
|
||||
}
|
||||
|
||||
location ~ /\.ht {
|
||||
deny all;
|
||||
}
|
||||
}
|
29
docker/php-fpm/Dockerfile
Normal file
29
docker/php-fpm/Dockerfile
Normal file
@ -0,0 +1,29 @@
|
||||
FROM php:8.0-fpm
|
||||
|
||||
WORKDIR "/var/www/html"
|
||||
|
||||
RUN apt-get update \
|
||||
&& apt-get install -y --no-install-recommends \
|
||||
git \
|
||||
zip \
|
||||
unzip \
|
||||
&& curl -sSL https://github.com/mlocati/docker-php-extension-installer/releases/latest/download/install-php-extensions -o - | sh -s \
|
||||
curl gd intl ldap mbstring mysqli odbc pdo pdo_mysql soap sockets xml zip xdebug exif sqlite3 gettext bcmath csv event imap inotify mcrypt redis \
|
||||
&& docker-php-ext-enable xdebug \
|
||||
&& curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer \
|
||||
&& curl -sLS https://deb.nodesource.com/setup_14.x | bash - \
|
||||
&& apt-get install -y nodejs \
|
||||
&& npm install -g npm \
|
||||
&& apt-get install -q -y ssmtp mailutils \
|
||||
&& echo "hostname=localhost.localdomain" > /etc/ssmtp/ssmtp.conf \
|
||||
&& echo "root=root@example.org" >> /etc/ssmtp/ssmtp.conf \
|
||||
&& echo "mailhub=mailpit:1025" >> /etc/ssmtp/ssmtp.conf \
|
||||
&& echo "sendmail_path=/usr/sbin/ssmtp -t" >> /usr/local/etc/php/conf.d/php-sendmail.ini \
|
||||
&& echo "alias ll=\"ls -al\"" >> /root/.bashrc \
|
||||
&& echo "export XDEBUG_TRIGGER=1" >> /root/.bashrc \
|
||||
&& echo "export PHP_IDE_CONFIG=\"serverName=host.docker.internal\"" >> /root/.bashrc \
|
||||
&& apt-get -y autoremove \
|
||||
&& apt-get clean \
|
||||
&& rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*
|
||||
|
||||
CMD ["bash", "docker/php-fpm/start-container"]
|
4
docker/php-fpm/php-ini-overrides.ini
Normal file
4
docker/php-fpm/php-ini-overrides.ini
Normal file
@ -0,0 +1,4 @@
|
||||
upload_max_filesize = 100M
|
||||
post_max_size = 100M
|
||||
xdebug.mode = debug
|
||||
xdebug.client_host = host.docker.internal
|
13
docker/php-fpm/start-container
Normal file
13
docker/php-fpm/start-container
Normal file
@ -0,0 +1,13 @@
|
||||
#!/bin/bash
|
||||
|
||||
echo "➜ Install Composer Dependencies"
|
||||
#composer install
|
||||
|
||||
echo "➜ Install NPM Dependencies"
|
||||
#npm install
|
||||
|
||||
echo "➜ Build Project Assets"
|
||||
#npx gulp compile
|
||||
|
||||
echo "➜ Listen To Incoming Requests"
|
||||
php-fpm
|
@ -1,22 +0,0 @@
|
||||
FROM php:7.4-apache
|
||||
|
||||
WORKDIR "/var/www/html"
|
||||
|
||||
ARG DEBIAN_FRONTEND=noninteractive
|
||||
|
||||
RUN apt-get update && apt-get install -y \
|
||||
libfreetype6-dev \
|
||||
libjpeg62-turbo-dev \
|
||||
libpng-dev \
|
||||
&& docker-php-ext-configure gd --with-freetype --with-jpeg \
|
||||
&& docker-php-ext-install -j$(nproc) gd gettext mysqli pdo_mysql
|
||||
|
||||
RUN pecl install xdebug \
|
||||
&& docker-php-ext-enable xdebug
|
||||
|
||||
ENV APACHE_DOCUMENT_ROOT "/var/www/html/public"
|
||||
|
||||
RUN a2enmod rewrite
|
||||
|
||||
RUN sed -ri -e 's!/var/www/html!${APACHE_DOCUMENT_ROOT}!g' /etc/apache2/sites-available/*.conf
|
||||
RUN sed -ri -e 's!/var/www/!${APACHE_DOCUMENT_ROOT}!g' /etc/apache2/apache2.conf /etc/apache2/conf-available/*.conf
|
@ -1,6 +0,0 @@
|
||||
date.timezone = UTC
|
||||
upload_max_filesize = 100M
|
||||
post_max_size = 100M
|
||||
xdebug.remote_enable = on
|
||||
xdebug.remote_host = host.docker.internal
|
||||
max_execution_time = 0
|
Loading…
Reference in New Issue
Block a user