Skip to content
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

HW1 - Работа с окружением #5

Open
wants to merge 1 commit into
base: AOrlov/main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions .env.example
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
POSTGRES_USER=postgres
POSTGRES_PASSWORD=postgres
PGDATA=/var/lib/postgresql/data/pgdata
POSTGRES_DB=postgres
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
# PHP_2023
# PHP_2024

https://otus.ru/lessons/razrabotchik-php/?utm_source=github&utm_medium=free&utm_campaign=otus
70 changes: 70 additions & 0 deletions docker-compose.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
version: '3'

volumes:
socket:

services:
redis:
image: redis
container_name: redis
ports:
- "6379:6379"
volumes:
- "./data/redis:/data"
networks:
- app-network

memcached:
container_name: memcached
image: memcached:latest
ports:
- "11211:11211"
networks:
- app-network

postgres:
image: postgres:latest
container_name: postgres
volumes:
- ./data/pg_data:/var/lib/postgresql
ports:
- "5434:5432"
expose:
- 5432
environment:
- POSTGRES_USER=${POSTGRES_USER}
- POSTGRES_PASSWORD=${POSTGRES_PASSWORD}
- PGDATA=${PGDATA}
- POSTGRES_DB=${POSTGRES_DB}
networks:
- app-network

nginx:
build:
context: ./nginx
dockerfile: Dockerfile
image: myapp/nginx
container_name: webserver
ports:
- "8002:80"
volumes:
- ./public:/data/application.local
- socket:/var/run/php-fpm
networks:
- app-network

app:
build:
context: ./fpm
dockerfile: Dockerfile
image: myapp/php
container_name: app
volumes:
- ./public:/data/application.local
- socket:/var/run/php-fpm
networks:
- app-network

networks:
app-network:
driver: bridge
38 changes: 38 additions & 0 deletions fpm/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
# Собираю образ на основе fedora, так как в ней есть все модули php под arm архитектуру
FROM fedora:37

# Установка php и расширений
RUN yum -y https://rpmfind.net/linux/fedora/linux/releases/37/Everything/aarch64/os/Packages/p/php-8.1.10-1.fc37.aarch64.rpm \
php \
php-bcmath \
php-xml \
php-pear \
php-pgsql \
php-gd \
php-soap \
php-pdo \
php-redis \
php-mbstring \
php-mcrypt \
php-soap \
php-devel \
php-process \
php-zip \
php-gmp \
php-fpm \
php-pecl-memcached \
php-ast \
&& php -r "copy('https://getcomposer.org/installer', 'composer-setup.php');" \
&& php composer-setup.php --install-dir=bin --filename=composer \
&& php -r "unlink('composer-setup.php');" \
&& composer self-update \
&& mkdir /data

# Глобальные настройки
COPY ./php-fpm.conf /etc/php-fpm.conf
COPY ./php.ini /usr/local/etc/php/conf.d/php-custom.ini
COPY ./www.conf /etc/php-fpm.d/www.conf

WORKDIR /data

CMD ["/usr/sbin/php-fpm", "--nodaemonize", "--force-stderr" ,"--fpm-config", "/etc/php-fpm.conf"]
26 changes: 26 additions & 0 deletions fpm/php-fpm.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
;;;;;;;;;;;;;;;;;;;;;
; FPM Configuration ;
;;;;;;;;;;;;;;;;;;;;;

; All relative paths in this configuration file are relative to PHP's install
; prefix.

; Include one or more files. If glob(3) exists, it is used to include a bunch of
; files from a glob(3) pattern. This directive can be used everywhere in the
; file.
include=/etc/php-fpm.d/*.conf

;;;;;;;;;;;;;;;;;;
; Global Options ;
;;;;;;;;;;;;;;;;;;

[global]
; Pid file
; Default Value: none
pid = /var/run/php-fpm.pid

; Error log file
; If it's set to "syslog", log is sent to syslogd instead of being written
; in a local file.
; Default Value: /var/log/php-fpm.log
error_log = /var/log/php-fpm/error.log
2 changes: 2 additions & 0 deletions fpm/php.ini
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
session.save_handler = memcache
session.save_path = "tcp://memcache:11211"
Loading
Loading