-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #12 from KarlsonComplete/add-docker-structure
Add docker containers
- Loading branch information
Showing
8 changed files
with
102 additions
and
1 deletion.
There are no files selected for viewing
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
services: | ||
php-fpm: | ||
build: | ||
context: ./docker/php-fpm | ||
volumes: | ||
- ./:/var/www/bitrix24-php-lib | ||
nginx: | ||
build: | ||
context: ./docker/nginx | ||
volumes: | ||
- ./:/var/www/bitrix24-php-lib | ||
ports: | ||
- "8081:80" | ||
depends_on: | ||
- php-fpm | ||
postgres-container: | ||
image: postgres | ||
build: | ||
context: ./docker/postgres | ||
ports: | ||
- "5432:5432" | ||
volumes: | ||
- ./docker/postgres/data:/var/lib/postgresql/data | ||
restart: always | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
FROM nginx:1.27-alpine | ||
|
||
RUN rm /etc/nginx/conf.d/default.conf | ||
|
||
COPY ./conf.d/nginx.conf /etc/nginx/conf.d/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
server { | ||
listen 80; | ||
server_name localhost; | ||
|
||
root /var/www/bitrix24-php-lib; | ||
index index.html index.htm index.php; | ||
|
||
# Redirects requests to index.php if the file is not found | ||
location / { | ||
try_files $uri $uri/ /index.php?$query_string; | ||
} | ||
|
||
# Passes PHP requests to PHP-FPM container | ||
location ~ \.php$ { | ||
include fastcgi_params; | ||
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; | ||
fastcgi_pass php-fpm:9000; # Replace with your PHP-FPM container name | ||
fastcgi_index index.php; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
FROM php:8.2-fpm-alpine | ||
|
||
RUN set -ex \ | ||
&& apk --no-cache add \ | ||
postgresql-dev \ | ||
oniguruma-dev \ | ||
libzip-dev \ | ||
curl-dev \ | ||
&& docker-php-ext-install pdo pdo_pgsql mbstring zip curl bcmath | ||
|
||
WORKDIR /bitrix24-php-lib | ||
|
||
COPY ./ ./ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
FROM postgres:16.4-alpine | ||
|
||
# Устанавливаем переменные окружения для настройки базы данных | ||
ENV POSTGRES_USER=kirill | ||
ENV POSTGRES_PASSWORD=bitrix24lib | ||
ENV POSTGRES_DB=bitrixAppDb | ||
|
||
# Копируем SQL-скрипты для инициализации базы данных (если есть) | ||
# COPY init.sql /docker-entrypoint-initdb.d/ | ||
|
||
# Открываем порт PostgreSQL | ||
EXPOSE 5432 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
<?php | ||
echo 'Hello123'; | ||
echo "<br>"; | ||
$conn_string = "pgsql:host=localhost;port=5432;dbname=bitrixAppDb;user=kirill;password=bitrix24lib"; | ||
try { | ||
$db = new PDO($conn_string); | ||
|
||
// Установка режима обработки ошибок | ||
$db->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION); | ||
|
||
echo "Подключение к базе данных успешно установлено."; | ||
}catch (PDOException $error) | ||
{ | ||
echo "Ошибка :". $error->getMessage(); | ||
} | ||
|
||
?> |