API Docker
This commit is contained in:
13
api/Dockerfile
Normal file
13
api/Dockerfile
Normal file
@ -0,0 +1,13 @@
|
|||||||
|
FROM php:8-fpm
|
||||||
|
|
||||||
|
RUN apt-get update \
|
||||||
|
&& apt-get install -y libc-client-dev libkrb5-dev git libzip-dev unzip qpdf \
|
||||||
|
&& rm -r /var/lib/apt/lists/* \
|
||||||
|
&& docker-php-ext-configure imap --with-kerberos --with-imap-ssl \
|
||||||
|
&& docker-php-ext-install imap zip pdo pdo_mysql
|
||||||
|
|
||||||
|
COPY ./errors.ini /usr/local/etc/php/conf.d/docker-php-errors.ini
|
||||||
|
|
||||||
|
COPY --from=composer /usr/bin/composer /usr/bin/composer
|
||||||
|
|
||||||
|
WORKDIR /app/api
|
49
api/docker-compose.yml
Normal file
49
api/docker-compose.yml
Normal file
@ -0,0 +1,49 @@
|
|||||||
|
version: '3'
|
||||||
|
services:
|
||||||
|
proxy:
|
||||||
|
profiles:
|
||||||
|
- api
|
||||||
|
volumes:
|
||||||
|
- ${API_PATH:-.}:/app/api
|
||||||
|
- ${API_PATH:-.}/nginx.conf:/etc/nginx/conf.d/api.conf
|
||||||
|
ports:
|
||||||
|
- "${API_PORT:-8080}:8080"
|
||||||
|
api:
|
||||||
|
profiles:
|
||||||
|
- api
|
||||||
|
container_name: emails-api
|
||||||
|
build:
|
||||||
|
context: ${API_PATH:-.}
|
||||||
|
restart: unless-stopped
|
||||||
|
env_file:
|
||||||
|
- ${API_PATH:-.}/.env
|
||||||
|
- ${API_PATH:-.}/.db.env
|
||||||
|
- .mail.env
|
||||||
|
- .key.env
|
||||||
|
volumes:
|
||||||
|
- ${API_PATH:-.}/:/app/api
|
||||||
|
- ${LOGS_PATH}/api:/logs
|
||||||
|
- ${ATT_PATH}:/attachments
|
||||||
|
db:
|
||||||
|
profiles:
|
||||||
|
- api
|
||||||
|
container_name: emails-db
|
||||||
|
image: mariadb
|
||||||
|
restart: unless-stopped
|
||||||
|
env_file:
|
||||||
|
- ${API_PATH:-.}/.db.env
|
||||||
|
volumes:
|
||||||
|
- emails_data:/var/lib/mysql
|
||||||
|
adminer:
|
||||||
|
profiles:
|
||||||
|
- testing
|
||||||
|
container_name: emails-adminer
|
||||||
|
image: adminer
|
||||||
|
restart: unless-stopped
|
||||||
|
env_file:
|
||||||
|
- ${API_PATH:-.}/.adminer.env
|
||||||
|
ports:
|
||||||
|
- "8081:8080"
|
||||||
|
|
||||||
|
volumes:
|
||||||
|
emails_data: {}
|
3
api/errors.ini
Normal file
3
api/errors.ini
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
error_reporting=E_ALL
|
||||||
|
log_errors=true
|
||||||
|
error_log=/logs/errors.log
|
36
api/nginx.conf
Normal file
36
api/nginx.conf
Normal file
@ -0,0 +1,36 @@
|
|||||||
|
server {
|
||||||
|
listen 0.0.0.0:8080;
|
||||||
|
root /app/api/public;
|
||||||
|
index index.php index.html index.htm;
|
||||||
|
|
||||||
|
access_log /var/logs/nginx/access.log;
|
||||||
|
error_log /var/logs/nginx/error.log;
|
||||||
|
|
||||||
|
location / {
|
||||||
|
try_files $uri $uri/ /index.php?$query_string;
|
||||||
|
}
|
||||||
|
location ~ \.php$ {
|
||||||
|
if ($request_method = 'OPTIONS') {
|
||||||
|
add_header 'Access-Control-Allow-Origin' '*';
|
||||||
|
add_header 'Access-Control-Allow-Headers' 'Authorization,Accept,Origin,DNT,X-CustomHeader,Keep-Alive,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type,Content-Range,Range';
|
||||||
|
add_header 'Access-Control-Allow-Methods' 'GET,POST,OPTIONS,PUT,DELETE,PATCH';
|
||||||
|
add_header 'Access-Control-Max-Age' 1728000;
|
||||||
|
add_header 'Content-Type' 'application/json';
|
||||||
|
add_header 'Content-Length' 0;
|
||||||
|
return 204;
|
||||||
|
}
|
||||||
|
|
||||||
|
add_header 'Access-Control-Allow-Origin' '*';
|
||||||
|
add_header 'Access-Control-Allow-Headers' 'Authorization,Accept,Origin,DNT,X-CustomHeader,Keep-Alive,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type,Content-Range,Range';
|
||||||
|
add_header 'Access-Control-Allow-Methods' 'GET,POST,OPTIONS,PUT,DELETE,PATCH';
|
||||||
|
|
||||||
|
try_files $uri =404;
|
||||||
|
fastcgi_split_path_info ^(.+\.php)(/.+)$;
|
||||||
|
fastcgi_pass api:9000;
|
||||||
|
fastcgi_index index.php;
|
||||||
|
include fastcgi_params;
|
||||||
|
fastcgi_param REQUEST_URI $request_uri;
|
||||||
|
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
|
||||||
|
fastcgi_param PATH_INFO $fastcgi_path_info;
|
||||||
|
}
|
||||||
|
}
|
Reference in New Issue
Block a user