Compare commits
13 Commits
Author | SHA1 | Date | |
---|---|---|---|
274927aff7 | |||
d890e0f27f | |||
01fa9779e6 | |||
265009303e | |||
c14f1fb6d5 | |||
7578a5599c | |||
276e05d656 | |||
ec9b1acaec | |||
73e3fc7391 | |||
00ee0c8605 | |||
7483dc6775 | |||
3fcb3fb886 | |||
4d7a5e6f52 |
1
.env.example
Normal file
1
.env.example
Normal file
@ -0,0 +1 @@
|
||||
LOCAL_CODE_ROOT=/var/www/http
|
4
.gitignore
vendored
4
.gitignore
vendored
@ -1,2 +1,4 @@
|
||||
.idea
|
||||
*.iml
|
||||
*.iml
|
||||
log
|
||||
.env
|
@ -1,31 +1,43 @@
|
||||
version: "3"
|
||||
|
||||
services:
|
||||
nginx:
|
||||
build:
|
||||
context: ./nginx/
|
||||
dockerfile: dockerfile
|
||||
ports:
|
||||
- 80:80
|
||||
networks:
|
||||
- server
|
||||
volumes:
|
||||
- ./nginx/conf.d:/etc/nginx/conf.d
|
||||
- ./nginx/sources.list:/etc/apt/sources.list
|
||||
- ${LOCAL_CODE_ROOT}:/var/www/http
|
||||
- ./log/nginx:/var/log/nginx
|
||||
container_name: nginx
|
||||
restart: always
|
||||
php7.4:
|
||||
build:
|
||||
context: ./php7.4/
|
||||
dockerfile: dockerfile
|
||||
volumes:
|
||||
- ./php7.4/sources.list:/etc/apt/sources.list
|
||||
- /var/www/http:/var/www/http
|
||||
- ${LOCAL_CODE_ROOT}:/var/www/http
|
||||
networks:
|
||||
- server
|
||||
container_name: php7.4
|
||||
container_name: php74
|
||||
ports:
|
||||
- 9000:9000
|
||||
restart: always
|
||||
mysql: # 添加 mysql 服务
|
||||
mysql:
|
||||
build:
|
||||
context: mysql/
|
||||
dockerfile: dockerfile
|
||||
restart: always
|
||||
environment:
|
||||
MYSQL_ROOT_PASSWORD: root
|
||||
# command: --character-set-server=utf8mb4 --collation-server=utf8mb4_unicode_ci # 设置编码
|
||||
# command: mysqld --character-set-server=utf8mb4 --collation-server=utf8mb4_unicode_ci #设置utf8字符集
|
||||
command: --default-authentication-plugin=mysql_native_password
|
||||
# volumes:
|
||||
# - ${MYSQL_DATA_PATH}:/var/lib/mysql
|
||||
# platform: linux/amd64 # apple silicon
|
||||
networks:
|
||||
- server
|
||||
ports:
|
||||
|
@ -1,2 +1 @@
|
||||
FROM mysql:5.7
|
||||
MAINTAINER tradewind
|
||||
|
2
nginx/conf.d/.gitignore
vendored
Normal file
2
nginx/conf.d/.gitignore
vendored
Normal file
@ -0,0 +1,2 @@
|
||||
*.conf
|
||||
!example.conf
|
19
nginx/conf.d/example.conf
Normal file
19
nginx/conf.d/example.conf
Normal file
@ -0,0 +1,19 @@
|
||||
server {
|
||||
listen 80;
|
||||
server_name example.com;
|
||||
root /var/www/http/example;
|
||||
index index.php;
|
||||
location / {
|
||||
try_files $uri $uri/ /index.php?$query_string;
|
||||
}
|
||||
|
||||
location ~ \.php$ {
|
||||
fastcgi_pass php7.4:9000;
|
||||
fastcgi_index index.php;
|
||||
fastcgi_split_path_info ^((?U).+\.php)(/?.+)$;
|
||||
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
|
||||
fastcgi_param PATH_INFO $fastcgi_path_info;
|
||||
fastcgi_param PATH_TRANSLATED $document_root$fastcgi_path_info;
|
||||
include fastcgi_params;
|
||||
}
|
||||
}
|
6
nginx/dockerfile
Normal file
6
nginx/dockerfile
Normal file
@ -0,0 +1,6 @@
|
||||
FROM nginx:alpine
|
||||
|
||||
RUN sed -i \
|
||||
's/dl-cdn.alpinelinux.org/mirrors.tuna.tsinghua.edu.cn/g' \
|
||||
/etc/apk/repositories && apk update
|
||||
WORKDIR /var/www/http/
|
9
nginx/sources.list
Normal file
9
nginx/sources.list
Normal file
@ -0,0 +1,9 @@
|
||||
# 默认注释了源码镜像以提高 apt update 速度,如有需要可自行取消注释
|
||||
deb https://mirrors.tuna.tsinghua.edu.cn/debian/ buster main contrib non-free
|
||||
# deb-src https://mirrors.tuna.tsinghua.edu.cn/debian/ buster main contrib non-free
|
||||
deb https://mirrors.tuna.tsinghua.edu.cn/debian/ buster-updates main contrib non-free
|
||||
# deb-src https://mirrors.tuna.tsinghua.edu.cn/debian/ buster-updates main contrib non-free
|
||||
deb https://mirrors.tuna.tsinghua.edu.cn/debian/ buster-backports main contrib non-free
|
||||
# deb-src https://mirrors.tuna.tsinghua.edu.cn/debian/ buster-backports main contrib non-free
|
||||
deb https://mirrors.tuna.tsinghua.edu.cn/debian-security buster/updates main contrib non-free
|
||||
# deb-src https://mirrors.tuna.tsinghua.edu.cn/debian-security buster/updates main contrib non-free
|
@ -1,7 +1,5 @@
|
||||
FROM php:7.4-fpm-alpine
|
||||
|
||||
MAINTAINER tradewind
|
||||
|
||||
RUN sed -i 's/dl-cdn.alpinelinux.org/mirrors.aliyun.com/g' /etc/apk/repositories
|
||||
|
||||
RUN apk add --no-cache --virtual .build-deps \
|
||||
@ -12,7 +10,6 @@ RUN apk add --no-cache --virtual .build-deps \
|
||||
libxml2-dev \
|
||||
postgresql-dev \
|
||||
sqlite-dev \
|
||||
libzip-dev \
|
||||
&& apk add --no-cache \
|
||||
curl \
|
||||
git \
|
||||
@ -20,6 +17,7 @@ RUN apk add --no-cache --virtual .build-deps \
|
||||
mysql-client \
|
||||
postgresql-libs \
|
||||
openssl \
|
||||
libzip-dev \
|
||||
&& pecl install imagick \
|
||||
&& docker-php-ext-enable imagick \
|
||||
&& pecl install xdebug-3.0.4 \
|
||||
@ -38,7 +36,9 @@ RUN apk add --no-cache --virtual .build-deps \
|
||||
&& curl -s https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin/ --filename=composer \
|
||||
&& apk del -f .build-deps
|
||||
|
||||
# 修改 composer 为国内镜像
|
||||
RUN composer config -g repo.packagist composer https://packagist.laravel-china.org
|
||||
RUN apk --no-cache add shadow && \
|
||||
usermod -u 1000 www-data && \
|
||||
groupmod -g 1000 www-data
|
||||
|
||||
WORKDIR /var/www
|
||||
# 修改 composer 为国内镜像
|
||||
RUN composer config -g repo.packagist composer https://mirrors.cloud.tencent.com/composer/
|
||||
|
@ -1,5 +1,5 @@
|
||||
FROM redis:6.2-alpine
|
||||
MAINTAINER tradewind
|
||||
|
||||
RUN sed -i \
|
||||
's/dl-cdn.alpinelinux.org/mirrors.tuna.tsinghua.edu.cn/g' \
|
||||
/etc/apk/repositories && apk update
|
Reference in New Issue
Block a user