-
Notifications
You must be signed in to change notification settings - Fork 1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add docker containers #12
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
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 | ||
|
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/ |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
server { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @KarlsonComplete это из елисеева или примеров симфони? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. У елисеева в первом видео было. |
||
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; | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
FROM php:8.2-fpm-alpine | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. а какие экстеншены ты по дефолту доставишь и включишь? |
||
|
||
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 ./ ./ |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
FROM postgres:16.4-alpine | ||
|
||
# Устанавливаем переменные окружения для настройки базы данных | ||
ENV POSTGRES_USER=kirill | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. погугли что там по этому поводу находится, закинь сюда варианты.
Кажись вот тут ребята рассказывали |
||
ENV POSTGRES_PASSWORD=bitrix24lib | ||
ENV POSTGRES_DB=bitrixAppDb | ||
|
||
# Копируем SQL-скрипты для инициализации базы данных (если есть) | ||
# COPY init.sql /docker-entrypoint-initdb.d/ | ||
|
||
# Открываем порт PostgreSQL | ||
EXPOSE 5432 |
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"; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. всё через переменные окружения |
||
try { | ||
$db = new PDO($conn_string); | ||
|
||
// Установка режима обработки ошибок | ||
$db->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION); | ||
|
||
echo "Подключение к базе данных успешно установлено."; | ||
}catch (PDOException $error) | ||
{ | ||
echo "Ошибка :". $error->getMessage(); | ||
} | ||
|
||
?> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@KarlsonComplete зачем тебе nginx если ты гонишь все в CLI?