13 Commits
1.0 ... test

Author SHA1 Message Date
274927aff7 #tradewind:fix php permission 2021-06-21 17:02:30 +08:00
d890e0f27f #tradewind:fix php permission 2021-06-19 18:41:22 +08:00
01fa9779e6 #tradewind:fix php permission 2021-06-19 18:02:21 +08:00
265009303e #tradewind:update composer 2021-06-15 18:20:19 +08:00
c14f1fb6d5 #tradewind:update gitignore 2021-06-08 20:22:52 +08:00
7578a5599c #tradewind:update gitignore 2021-06-08 20:22:20 +08:00
276e05d656 #tradewind:add gitignore 2021-06-08 19:03:33 +08:00
ec9b1acaec #tradewind:add gitignore 2021-06-08 18:58:04 +08:00
73e3fc7391 #tradewind:fix nginx & zip 2021-06-08 18:48:13 +08:00
00ee0c8605 #tradewind:add env 2021-06-07 15:23:23 +08:00
7483dc6775 #tradewind:add env 2021-06-07 15:22:46 +08:00
3fcb3fb886 #tradewind:add nginx 2021-06-07 15:16:11 +08:00
4d7a5e6f52 #tradewind:add nginx 2021-06-07 15:12:15 +08:00
10 changed files with 66 additions and 16 deletions

1
.env.example Normal file
View File

@ -0,0 +1 @@
LOCAL_CODE_ROOT=/var/www/http

2
.gitignore vendored
View File

@ -1,2 +1,4 @@
.idea .idea
*.iml *.iml
log
.env

View File

@ -1,31 +1,43 @@
version: "3" version: "3"
services: 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: php7.4:
build: build:
context: ./php7.4/ context: ./php7.4/
dockerfile: dockerfile dockerfile: dockerfile
volumes: volumes:
- ./php7.4/sources.list:/etc/apt/sources.list - ./php7.4/sources.list:/etc/apt/sources.list
- /var/www/http:/var/www/http - ${LOCAL_CODE_ROOT}:/var/www/http
networks: networks:
- server - server
container_name: php7.4 container_name: php74
ports: ports:
- 9000:9000 - 9000:9000
restart: always restart: always
mysql: # 添加 mysql 服务 mysql:
build: build:
context: mysql/ context: mysql/
dockerfile: dockerfile dockerfile: dockerfile
restart: always restart: always
environment: environment:
MYSQL_ROOT_PASSWORD: root 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 command: --default-authentication-plugin=mysql_native_password
# volumes: # platform: linux/amd64 # apple silicon
# - ${MYSQL_DATA_PATH}:/var/lib/mysql
networks: networks:
- server - server
ports: ports:

View File

@ -1,2 +1 @@
FROM mysql:5.7 FROM mysql:5.7
MAINTAINER tradewind

2
nginx/conf.d/.gitignore vendored Normal file
View File

@ -0,0 +1,2 @@
*.conf
!example.conf

19
nginx/conf.d/example.conf Normal file
View 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
View 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
View 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

View File

@ -1,7 +1,5 @@
FROM php:7.4-fpm-alpine FROM php:7.4-fpm-alpine
MAINTAINER tradewind
RUN sed -i 's/dl-cdn.alpinelinux.org/mirrors.aliyun.com/g' /etc/apk/repositories RUN sed -i 's/dl-cdn.alpinelinux.org/mirrors.aliyun.com/g' /etc/apk/repositories
RUN apk add --no-cache --virtual .build-deps \ RUN apk add --no-cache --virtual .build-deps \
@ -12,7 +10,6 @@ RUN apk add --no-cache --virtual .build-deps \
libxml2-dev \ libxml2-dev \
postgresql-dev \ postgresql-dev \
sqlite-dev \ sqlite-dev \
libzip-dev \
&& apk add --no-cache \ && apk add --no-cache \
curl \ curl \
git \ git \
@ -20,6 +17,7 @@ RUN apk add --no-cache --virtual .build-deps \
mysql-client \ mysql-client \
postgresql-libs \ postgresql-libs \
openssl \ openssl \
libzip-dev \
&& pecl install imagick \ && pecl install imagick \
&& docker-php-ext-enable imagick \ && docker-php-ext-enable imagick \
&& pecl install xdebug-3.0.4 \ && 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 \ && curl -s https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin/ --filename=composer \
&& apk del -f .build-deps && apk del -f .build-deps
# 修改 composer 为国内镜像 RUN apk --no-cache add shadow && \
RUN composer config -g repo.packagist composer https://packagist.laravel-china.org 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/

View File

@ -1,5 +1,5 @@
FROM redis:6.2-alpine FROM redis:6.2-alpine
MAINTAINER tradewind
RUN sed -i \ RUN sed -i \
's/dl-cdn.alpinelinux.org/mirrors.tuna.tsinghua.edu.cn/g' \ 's/dl-cdn.alpinelinux.org/mirrors.tuna.tsinghua.edu.cn/g' \
/etc/apk/repositories && apk update /etc/apk/repositories && apk update