Skip to content

Commit 5a762b5

Browse files
committed
docker
0 parents  commit 5a762b5

File tree

7 files changed

+201
-0
lines changed

7 files changed

+201
-0
lines changed

.env

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
COMPOSE_PROJECT_NAME=docker
2+
COMPOSE_PROJECT_NETWORK=173.2.0
3+
COMPOSE_USER_NAME=$USER
4+
COMPOSE_USER_UID=1000

.idea/.gitignore

Lines changed: 8 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

docker-compose.yml

Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
1+
version: "3.7"
2+
services:
3+
nginx:
4+
container_name: nginx_${COMPOSE_PROJECT_NAME}
5+
image: nginx:latest
6+
working_dir: /app
7+
volumes:
8+
- ./:/app
9+
- ./docker/nginx/templates:/etc/nginx/templates
10+
networks:
11+
default:
12+
ipv4_address: ${COMPOSE_PROJECT_NETWORK}.2
13+
extra_hosts:
14+
- 'host.docker.internal:host-gateway'
15+
depends_on:
16+
- php-fpm
17+
php-fpm:
18+
container_name: php_fpm_${COMPOSE_PROJECT_NAME}
19+
image: php_fpm_${COMPOSE_PROJECT_NAME}
20+
build:
21+
args:
22+
user: $COMPOSE_USER_NAME
23+
uid: $COMPOSE_USER_UID
24+
context: ./
25+
dockerfile: docker/php-fpm/Dockerfile
26+
volumes:
27+
- ./:/app
28+
- ./docker/php-fpm/php.ini:/usr/local/etc/php/php.ini
29+
- ./docker/php-fpm/xdebug.ini:/usr/local/etc/php/conf.d/xdebug.ini
30+
networks:
31+
default:
32+
ipv4_address: ${COMPOSE_PROJECT_NETWORK}.3
33+
postgres:
34+
container_name: postgres_dental
35+
image: postgres:14.5-alpine
36+
restart: unless-stopped
37+
environment:
38+
POSTGRES_DATABASE: "${DB_DATABASE}"
39+
POSTGRES_PASSWORD: "${DB_PASSWORD}"
40+
POSTGRES_USER: "${DB_USERNAME}"
41+
POSTGRES_HOST_AUTH_METHOD: "trust"
42+
POSTGRES_ALLOW_EMPTY_PASSWORD: 1
43+
POSTGRES_ROOT_PASSWORD: "root"
44+
volumes:
45+
- ../database:/var/lib/postgresql/data
46+
ports:
47+
- "8101:5432"
48+
networks:
49+
default:
50+
ipv4_address: ${COMPOSE_PROJECT_NETWORK}.4
51+
redis:
52+
container_name: redis
53+
image: redis:alpine
54+
# restart: always
55+
# ports:
56+
# - '6379:6379'
57+
# command: redis-server --save 20 1 --loglevel warning --requirepass eYVX7EwVmmxKPCDmwMtyKVge8oLd2t81
58+
# volumes:
59+
# - /cache:/data
60+
networks:
61+
default:
62+
ipv4_address: ${COMPOSE_PROJECT_NETWORK}.5
63+
networks:
64+
default:
65+
driver: bridge
66+
ipam:
67+
driver: default
68+
config:
69+
- subnet: ${COMPOSE_PROJECT_NETWORK}.0/16
70+
gateway: ${COMPOSE_PROJECT_NETWORK}.1
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
server {
2+
listen 80;
3+
listen [::]:80;
4+
server_name _;
5+
6+
client_max_body_size 100M;
7+
root /app/public;
8+
9+
location / {
10+
11+
index index.php;
12+
include /etc/nginx/mime.types;
13+
14+
try_files $uri $uri/ /index.php?$query_string;
15+
16+
location ~ /\.(?!well-known).* {
17+
deny all;
18+
}
19+
}
20+
location ~ \.php$ {
21+
try_files $uri =404;
22+
fastcgi_split_path_info ^(.+\.php)(/.+)$;
23+
fastcgi_pass php-fpm:9000;
24+
fastcgi_index index.php;
25+
include fastcgi_params;
26+
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
27+
fastcgi_param PATH_INFO $fastcgi_path_info;
28+
}
29+
}

docker/php-fpm/Dockerfile

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
FROM php:8.2-fpm
2+
3+
ARG user
4+
ARG uid
5+
6+
EXPOSE 9000
7+
8+
RUN apt-get update
9+
10+
RUN apt-get update && apt-get install -y \
11+
apt-utils \
12+
libpq-dev \
13+
libpng-dev \
14+
libzip-dev \
15+
zip unzip \
16+
git && \
17+
docker-php-ext-install pdo pdo_pgsql pgsql &&\
18+
docker-php-ext-install bcmath && \
19+
docker-php-ext-install gd && \
20+
docker-php-ext-install zip
21+
22+
23+
RUN apt-get clean && rm -rf /var/lib/apt/lists/*
24+
25+
26+
RUN pecl install xdebug \
27+
&& docker-php-ext-enable xdebug
28+
29+
COPY --from=composer:latest /usr/bin/composer /usr/bin/composer
30+
31+
RUN useradd -G www-data,root -u $uid -d /home/$user $user
32+
RUN mkdir -p /home/$user/.composer && \
33+
chown -R $user:$user /home/$user
34+
35+
WORKDIR /app
36+
37+
USER $user
38+
39+
#CMD ["php-fpm"]

docker/php-fpm/php.ini

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
memory_limit=1024M
2+
max_execution_time=360
3+
max_input_time=120
4+
max_input_vars=10000
5+
post_max_size=100M
6+
upload_max_filesize=2048M
7+
;xdebug.mode=debug

docker/php-fpm/xdebug.ini

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
[xdebug]
2+
3+
; 2.9
4+
;xdebug.profiler_append = 0
5+
;xdebug.profiler_enable = 1
6+
;xdebug.profiler_enable_trigger = 0
7+
;xdebug.remote_enable = 1
8+
;xdebug.remote_host = "172.21.0.1"
9+
;xdebug.remote_autostart=on
10+
;xdebug.remote_connect_back=on
11+
;xdebug.remote_port=9000
12+
;xdebug.remote_mode=req
13+
;xdebug.idekey="PHPSTORM"
14+
15+
;3.0
16+
;xdebug.mode = debug,profile
17+
;xdebug.start_with_request = yes
18+
;xdebug.discover_client_host = 1
19+
;xdebug.client_port=9000
20+
;xdebug.client_host=host.docker.internal
21+
22+
23+
xdebug.mode = debug
24+
xdebug.discover_client_host = 1
25+
xdebug.client_port=9000
26+
xdebug.client_host=173.2.0.2
27+
xdebug.remote_handler=dbgp
28+
xdebug.start_with_request=yes
29+
;xdebug.discover_client_host=0
30+
xdebug.idekey=PHPSTORM
31+
xdebug.show_error_trace = 1
32+
xdebug.max_nesting_level=250
33+
xdebug.log_level=0
34+
xdebug.var_display_max_depth=10
35+
xdebug.log=/var/log/xdebug.log
36+
string xdebug.client_host=host.docker.internal
37+
38+
;xdebug.profiler_append = 0
39+
;xdebug.profiler_enable = 1
40+
;xdebug.profiler_enable_trigger = 0
41+
;xdebug.remote_enable = 1
42+
;xdebug.remote_host = "172.21.0.1"
43+
;xdebug.remote_autostart=on
44+
;xdebug.remote_connect_back=on

0 commit comments

Comments
 (0)