fix: connect docker php to host-only test database
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
FROM registry.cn-guangzhou.aliyuncs.com/likeadmin/php:8.0.30.3-fpm
|
||||
|
||||
RUN docker-php-ext-install -j"$(nproc)" opcache
|
||||
RUN docker-php-ext-install -j"$(nproc)" opcache \
|
||||
&& sed -i 's/^listen = 127\.0\.0\.1:9000$/listen = 0.0.0.0:9000/' /usr/local/etc/php-fpm.d/www.conf
|
||||
|
||||
COPY docker/config/php/conf.d/zz-opcache.ini /usr/local/etc/php/conf.d/zz-opcache.ini
|
||||
|
||||
@@ -17,7 +17,7 @@ server {
|
||||
|
||||
location ~ \.php$ {
|
||||
include fastcgi_params;
|
||||
fastcgi_pass server:9000;
|
||||
fastcgi_pass host.docker.internal:9000;
|
||||
fastcgi_index index.php;
|
||||
fastcgi_param SCRIPT_FILENAME /likeadmin_php/server/public$fastcgi_script_name;
|
||||
}
|
||||
|
||||
@@ -11,33 +11,29 @@ services:
|
||||
<<: *php-image
|
||||
working_dir: /likeadmin_php/server
|
||||
restart: unless-stopped
|
||||
network_mode: host
|
||||
volumes:
|
||||
- ../server:/likeadmin_php/server
|
||||
- ./.env.server:/likeadmin_php/server/.env:ro
|
||||
extra_hosts:
|
||||
- "host.docker.internal:host-gateway"
|
||||
networks:
|
||||
- sport-era-dev
|
||||
|
||||
scheduler:
|
||||
<<: *php-image
|
||||
working_dir: /likeadmin_php/server
|
||||
restart: unless-stopped
|
||||
network_mode: host
|
||||
command: >-
|
||||
sh -c "while true; do php think crontab; sleep 60; done"
|
||||
volumes:
|
||||
- ../server:/likeadmin_php/server
|
||||
- ./.env.server:/likeadmin_php/server/.env:ro
|
||||
extra_hosts:
|
||||
- "host.docker.internal:host-gateway"
|
||||
networks:
|
||||
- sport-era-dev
|
||||
|
||||
nginx:
|
||||
image: registry.cn-guangzhou.aliyuncs.com/likeadmin/nginx:1.23.1
|
||||
restart: unless-stopped
|
||||
depends_on:
|
||||
- server
|
||||
extra_hosts:
|
||||
- "host.docker.internal:host-gateway"
|
||||
ports:
|
||||
- "8000:80"
|
||||
volumes:
|
||||
|
||||
Reference in New Issue
Block a user