Skip to content

Commit 1a16ec6

Browse files
author
Alexander Viktorchik
committed
add docker-compose
1 parent 2714ef1 commit 1a16ec6

File tree

4 files changed

+53
-0
lines changed

4 files changed

+53
-0
lines changed

README.md

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,17 @@
1111
composer require yourpayments/php-api-client
1212
```
1313
(если на вашем проекте нет composer, слонируйте или скачайте, а затем подключите ([require](https://www.php.net/manual/ru/function.require.php)) файлы этого репозитория)
14+
15+
## Запуск с помощью docker compose
16+
Создайте и запустите docker контейнеры следующей командой:
17+
```shell
18+
docker compose up
19+
```
20+
либо в фоновом режиме командой:
21+
```shell
22+
docker compose up --detach
23+
```
24+
После выполнения проект будет доступен по адресу http://localhost:8080/
1425

1526
### Примеры с комментариями на русском языке:
1627
##### 1. Начало работы

docker-compose.yml

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
version: '4'
2+
name: php-api-client
3+
4+
services:
5+
nginx:
6+
image: nginx:latest
7+
volumes:
8+
- ./docker/nginx/.conf:/etc/nginx/conf.d/default.conf
9+
- ./:/var/www/php-api-client
10+
- ./docker/nginx/logs:/var/log/nginx
11+
ports:
12+
- "8080:80"
13+
depends_on:
14+
- php
15+
container_name: php-api-client-nginx-container
16+
php:
17+
build: ./docker/php
18+
volumes:
19+
- ./:/var/www/php-api-client
20+
container_name: php-api-client-php-container

docker/nginx/.conf

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
server {
2+
server_name php-api-client;
3+
root /var/www/php-api-client;
4+
5+
index index.php;
6+
7+
location ~ \.php$ {
8+
fastcgi_pass php:9000;
9+
10+
include fastcgi_params;
11+
fastcgi_param SCRIPT_FILENAME $realpath_root$fastcgi_script_name;
12+
fastcgi_param DOCUMENT_ROOT $realpath_root;
13+
}
14+
15+
error_log /var/log/nginx/project_error.log;
16+
access_log /var/log/nginx/project_access.log;
17+
}

docker/php/Dockerfile

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
FROM php:8.3-fpm
2+
3+
RUN apt-get update && apt-get install -y curl libcurl4-openssl-dev libmcrypt-dev libonig-dev
4+
5+
RUN docker-php-ext-install curl mbstring

0 commit comments

Comments
 (0)