php: add docker files

This commit is contained in:
vanyauhalin
2023-07-24 14:46:17 +04:00
parent ab48645ba8
commit 8829f969d3
3 changed files with 101 additions and 0 deletions

View File

@ -0,0 +1,14 @@
FROM php:8.2.8-fpm-alpine3.18 AS example
WORKDIR /srv
COPY . .
RUN \
chown -R www-data:www-data /srv && \
apk update && \
apk add --no-cache \
composer \
make && \
make prod
CMD ["make", "server-prod"]
FROM nginx:1.23.4-alpine3.17 AS proxy
COPY proxy/nginx.conf /etc/nginx/nginx.conf

View File

@ -0,0 +1,40 @@
version: "3.8"
services:
document-server:
container_name: document-server
image: onlyoffice/documentserver:7.3.3.50
expose:
- "80"
environment:
- JWT_SECRET=your-256-bit-secret
example:
container_name: example
build:
context: .
target: example
expose:
- "80"
volumes:
- "example:/srv"
environment:
- ADDRESS=0.0.0.0
- DOCUMENT_SERVER_URL=http://localhost:8080/
- EXAMPLE_URL=http://proxy
- JWT_SECRET=your-256-bit-secret
- PORT=80
proxy:
container_name: proxy
build:
context: .
target: proxy
ports:
- "80:80"
- "8080:8080"
volumes:
- "example:/srv"
volumes:
example:

View File

@ -0,0 +1,47 @@
worker_processes auto;
events {
worker_connections 512;
}
http {
include /etc/nginx/mime.types;
server {
listen 80;
root /srv;
server_name localhost;
location / {
index index.html index.php;
try_files $uri $uri/ /index.php?$query_string;
}
location ~ \.php$ {
include fastcgi_params;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_pass example:80;
}
}
server {
listen 8080;
server_name localhost;
location / {
client_max_body_size 100m;
proxy_http_version 1.1;
proxy_pass http://document-server;
proxy_redirect off;
proxy_set_header Connection "upgrade";
proxy_set_header Host $http_host;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Host $http_x_forwarded_host;
proxy_set_header X-Forwarded-Proto $http_x_forwarded_proto;
proxy_set_header X-Real-IP $remote_addr;
}
}
}