-
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
Добавил Docker. Сделал связь между PHP-FPM и Nginx через Unix-Socket.… #71
Open
mettlive
wants to merge
3
commits into
BeliaevNO/main
Choose a base branch
from
BeliaevNO/HomeWork1
base: BeliaevNO/main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 1 commit
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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,2 @@ | ||
POSTGRES_USER=root | ||
POSTGRES_PASSWORD=root |
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,2 @@ | ||
MYSQL_DATABASE=laravel | ||
MYSQL_ROOT_PASSWORD=your_mysql_root_password |
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,4 @@ | ||
<?php | ||
echo "Hello, Проверяющие :)"; | ||
|
||
phpinfo(); | ||
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,27 @@ | ||
FROM php:8.3-fpm | ||
|
||
RUN apt-get update && apt-get install -y \ | ||
curl \ | ||
wget \ | ||
git \ | ||
libfreetype6-dev \ | ||
libjpeg62-turbo-dev \ | ||
libpng-dev \ | ||
libonig-dev \ | ||
libzip-dev \ | ||
&& docker-php-ext-install -j$(nproc) iconv mbstring mysqli pdo_mysql zip \ | ||
&& docker-php-ext-configure gd --with-freetype --with-jpeg \ | ||
&& docker-php-ext-install -j$(nproc) gd \ | ||
&& mkdir -p /run/php | ||
|
||
# Устанавливаем Composer | ||
RUN curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer | ||
COPY php.ini /usr/local/etc/php/conf.d/php-custom.ini | ||
COPY zz-docker.conf /usr/local/etc/php-fpm.d/zz-docker.conf | ||
|
||
|
||
WORKDIR /data | ||
|
||
VOLUME /data | ||
|
||
CMD ["php-fpm"] |
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,2 @@ | ||
session.save_handler = memcache | ||
session.save_path = "tcp://memcache:11211" |
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,6 @@ | ||
[global] | ||
daemonize = no | ||
|
||
[www] | ||
listen = /run/php/php-fpm.sock | ||
listen.mode = 0666 |
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,7 @@ | ||
FROM nginx:latest | ||
COPY hosts/application.local.conf /etc/nginx/conf.d/application.local.conf | ||
|
||
WORKDIR /data | ||
VOLUME /data | ||
EXPOSE 80 | ||
CMD ["nginx", "-g", "daemon off;"] |
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,26 @@ | ||
server { | ||
listen 80; | ||
server_name application.local; | ||
|
||
root /data/application.local; | ||
|
||
index index.php index.html; | ||
|
||
location ~* .(jpg|jpeg|gif|css|png|js|ico|html)$ { | ||
access_log off; | ||
expires max; | ||
} | ||
|
||
location / { | ||
try_files $uri $uri/ /index.php?$query_string; | ||
} | ||
|
||
location ~* .php$ { | ||
try_files $uri = 404; | ||
fastcgi_split_path_info ^(.+.php)(/.+)$; | ||
fastcgi_pass unix:/var/run/php/php-fpm.sock; | ||
fastcgi_index index.php; | ||
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; | ||
include fastcgi_params; | ||
} | ||
} |
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,4 @@ | ||
<?php | ||
echo "Hello, Otus!"; | ||
|
||
phpinfo(); | ||
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,65 @@ | ||
|
||
version: '3' | ||
|
||
services: | ||
app: | ||
build: | ||
context: Docker/fpm | ||
dockerfile: Dockerfile | ||
image: myapp/php | ||
container_name: app | ||
volumes: | ||
- ./Docker/code:/data/application.local | ||
- "phpsocket:/var/run" | ||
networks: | ||
- app-network | ||
|
||
webserver: | ||
build: | ||
context: Docker/nginx | ||
dockerfile: Dockerfile | ||
image: myapp/nginx | ||
container_name: webserver | ||
ports: | ||
- "8080:80" | ||
- "443:443" | ||
volumes: | ||
- ./Docker/code:/data/application.local | ||
- "phpsocket:/var/run" | ||
networks: | ||
- app-network | ||
|
||
memcached: | ||
image: memcached:latest | ||
ports: | ||
- "11211:11211" | ||
networks: | ||
- app-network | ||
|
||
redis: | ||
image: redis:latest | ||
ports: | ||
- "6379:6379" | ||
networks: | ||
- app-network | ||
|
||
postgres_db: | ||
image: postgres:latest | ||
container_name: db | ||
restart: always | ||
environment: | ||
- POSTGRES_USER=${POSTGRES_USER} | ||
- POSTGRES_PASSWORD=${POSTGRES_PASSWORD} | ||
ports: | ||
- '5432:5432' | ||
volumes: | ||
- postgres_db:/var/lib/postgresql/data | ||
|
||
|
||
volumes: | ||
postgres_db: | ||
driver: local | ||
phpsocket: | ||
networks: | ||
app-network: | ||
driver: bridge |
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,54 @@ | ||
# версия синтаксиса | ||
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. Вот только что проверял человека у которого был практически идентичные файлы. |
||
version: '3' | ||
|
||
# в этом блоке мы описываем контейнеры, которые будут запускаться | ||
services: | ||
|
||
#Контейнер с PHP, назовём его app | ||
app: | ||
# Если нет секции build, то система будет искать образ в репозиториях | ||
build: | ||
context: ./fpm | ||
dockerfile: Dockerfile | ||
image: myapp/php # имя будущего образа | ||
container_name: app # имя контейнера после запуска | ||
volumes: | ||
- ./code:/data/mysite.local | ||
# мы можем создать для контейнеров внутреннюю сеть | ||
networks: | ||
- app-network | ||
|
||
#контейне с Nginx | ||
webserver: | ||
build: | ||
context: ./nginx | ||
dockerfile: Dockerfile | ||
image: myapp/nginx | ||
container_name: webserver | ||
volumes: | ||
- ./code:/data/mysite.local | ||
# проброс портов | ||
ports: | ||
- "80:80" | ||
- "443:443" | ||
networks: | ||
- app-network | ||
|
||
#MySQL Service | ||
db: | ||
image: mysql:5.7.22 | ||
container_name: db | ||
ports: | ||
- "3306:3306" | ||
environment: | ||
MYSQL_DATABASE: ${MYSQL_DATABASE} | ||
MYSQL_ROOT_PASSWORD: ${MYSQL_ROOT_PASSWORD} | ||
networks: | ||
- app-network | ||
volumes: | ||
- ./dbdata:/var/lib/mysql | ||
|
||
#Docker Networks | ||
networks: | ||
app-network: | ||
driver: bridge |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
Закомичен .env. Его надо удалить и добавить в .gitignore