Compare commits
21 Commits
Author | SHA1 | Date | |
---|---|---|---|
df43e75dff | |||
4b5a861360 | |||
804eb5544f | |||
9f308af6b0 | |||
c29903b394 | |||
ddce943c33 | |||
4a4b03836d | |||
fd2c7c00dc | |||
f8cd066ef2 | |||
0041f06ff1 | |||
5fa3908c72 | |||
265009303e | |||
c14f1fb6d5 | |||
7578a5599c | |||
276e05d656 | |||
ec9b1acaec | |||
73e3fc7391 | |||
00ee0c8605 | |||
7483dc6775 | |||
3fcb3fb886 | |||
4d7a5e6f52 |
2
.env.example
Normal file
2
.env.example
Normal file
@ -0,0 +1,2 @@
|
||||
LOCAL_CODE_ROOT=/Users/tradewind/Projects
|
||||
PROJECT_PATH=/Users/tradewind/Projects/example
|
3
.gitignore
vendored
3
.gitignore
vendored
@ -1,2 +1,5 @@
|
||||
.idea
|
||||
*.iml
|
||||
log
|
||||
.env
|
||||
.DS_Store
|
90
README.md
Normal file
90
README.md
Normal file
@ -0,0 +1,90 @@
|
||||
# PHP Docker 开发环境
|
||||
|
||||
一个完整的PHP开发环境,包含多版本PHP、数据库、缓存等服务。
|
||||
|
||||
## 服务列表
|
||||
|
||||
| 服务 | 端口 | 版本 | 说明 |
|
||||
|------|------|------|------|
|
||||
| Nginx | 80 | latest | Web服务器 |
|
||||
| PHP 7.1 | 9000 | 7.1 | PHP-FPM |
|
||||
| PHP 7.4 | 9000 | 7.4 | PHP-FPM |
|
||||
| PHP 8.3 | 9000 | 8.3 | PHP-FPM |
|
||||
| MySQL | 3306 | 5.7 | 数据库 |
|
||||
| MySQL8 | 3306 | 8.0 | 数据库 |
|
||||
| Redis | 6379 | latest | 缓存 |
|
||||
| Python | 8000 | latest | Python环境 |
|
||||
| Node.js | - | latest | Node.js环境 |
|
||||
|
||||
## 快速开始
|
||||
|
||||
### 1. 环境变量配置
|
||||
创建 `.env` 文件并设置以下变量:
|
||||
```bash
|
||||
LOCAL_CODE_ROOT=/path/to/your/code # 本地代码目录
|
||||
PROJECT_PATH=/path/to/your/project # 项目路径
|
||||
```
|
||||
|
||||
### 2. 启动服务
|
||||
|
||||
**普通环境:**
|
||||
```bash
|
||||
docker-compose up -d
|
||||
```
|
||||
|
||||
**WSL环境:**
|
||||
```bash
|
||||
docker-compose -f docker-compose.yml -f docker-compose.wsl.yml up -d
|
||||
```
|
||||
|
||||
### 3. 验证服务
|
||||
```bash
|
||||
docker-compose ps
|
||||
```
|
||||
|
||||
## 使用说明
|
||||
|
||||
### Nginx配置
|
||||
- 配置文件位置:`./nginx/conf.d/`
|
||||
- 参考示例:`./nginx/conf.d/example.conf`
|
||||
- 网站根目录:`/var/www/http`
|
||||
|
||||
### PHP版本切换
|
||||
在Nginx配置中修改 `fastcgi_pass` 参数:
|
||||
- PHP 7.1:`fastcgi_pass php71:9000;`
|
||||
- PHP 7.4:`fastcgi_pass php74:9000;`
|
||||
- PHP 8.3:`fastcgi_pass php83:9000;`
|
||||
|
||||
### 数据库连接
|
||||
- **MySQL 5.7**:`mysql:3306`,用户名/密码:`root/root`
|
||||
- **MySQL 8.0**:`mysql8:3306`,用户名/密码:`root/root`
|
||||
- **Redis**:`redis:6379`
|
||||
|
||||
### 常用命令
|
||||
|
||||
**查看日志:**
|
||||
```bash
|
||||
docker-compose logs -f [服务名]
|
||||
```
|
||||
|
||||
**进入容器:**
|
||||
```bash
|
||||
docker exec -it [容器名] bash
|
||||
```
|
||||
|
||||
**重启服务:**
|
||||
```bash
|
||||
docker-compose restart [服务名]
|
||||
```
|
||||
|
||||
**停止所有服务:**
|
||||
```bash
|
||||
docker-compose down
|
||||
```
|
||||
|
||||
## 注意事项
|
||||
|
||||
1. 确保本地80、3306、6379端口未被占用
|
||||
2. WSL环境需要额外的挂载配置
|
||||
3. Xdebug已预配置,端口9003
|
||||
4. 日志文件保存在 `./log/` 目录
|
12
docker-compose.wsl.yml
Normal file
12
docker-compose.wsl.yml
Normal file
@ -0,0 +1,12 @@
|
||||
# docker-compose.wsl.yml(WSL 专用挂载)
|
||||
version: '3.8'
|
||||
services:
|
||||
php71:
|
||||
volumes:
|
||||
- /mnt/d:/mnt/d # WSL 特有挂载
|
||||
php74:
|
||||
volumes:
|
||||
- /mnt/d:/mnt/d # WSL 特有挂载
|
||||
php83:
|
||||
volumes:
|
||||
- /mnt/d:/mnt/d # WSL 特有挂载
|
@ -1,36 +1,92 @@
|
||||
version: "3"
|
||||
|
||||
services:
|
||||
php7.4:
|
||||
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
|
||||
php71:
|
||||
build:
|
||||
context: ./php7.1/
|
||||
dockerfile: dockerfile
|
||||
# args:
|
||||
# PROJECT_PATH: ${PROJECT_PATH:-/opt/project}
|
||||
volumes:
|
||||
- ./php7.1/sources.list:/etc/apt/sources.list
|
||||
- ./php7.1/docker-php-ext-xdebug.ini:/usr/local/etc/php/conf.d/docker-php-ext-xdebug.ini
|
||||
- ./php7.1/php.ini:/usr/local/etc/php/php.ini
|
||||
- ${LOCAL_CODE_ROOT}:/var/www/http
|
||||
- ${PROJECT_PATH}:/opt/project # fix idea+python中xdebug项目路径
|
||||
networks:
|
||||
- server
|
||||
container_name: php71
|
||||
restart: always
|
||||
php74:
|
||||
build:
|
||||
context: ./php7.4/
|
||||
dockerfile: dockerfile
|
||||
# args:
|
||||
# PROJECT_PATH: ${PROJECT_PATH:-/opt/project}
|
||||
volumes:
|
||||
- ./php7.4/sources.list:/etc/apt/sources.list
|
||||
- /var/www/http:/var/www/http
|
||||
- ./php7.4/docker-php-ext-xdebug.ini:/usr/local/etc/php/conf.d/docker-php-ext-xdebug.ini
|
||||
- ./php7.4/php.ini:/usr/local/etc/php/php.ini
|
||||
- ${LOCAL_CODE_ROOT}:/var/www
|
||||
networks:
|
||||
- server
|
||||
container_name: php7.4
|
||||
ports:
|
||||
- 9000:9000
|
||||
container_name: php74
|
||||
restart: always
|
||||
mysql: # 添加 mysql 服务
|
||||
php83:
|
||||
build:
|
||||
context: ./php8.3/
|
||||
dockerfile: dockerfile
|
||||
volumes:
|
||||
- ./php8.3/sources.list:/etc/apt/sources.list
|
||||
- ./php8.3/docker-php-ext-xdebug.ini:/usr/local/etc/php/conf.d/docker-php-ext-xdebug.ini
|
||||
- ./php8.3/php.ini:/usr/local/etc/php/php.ini
|
||||
- ${LOCAL_CODE_ROOT}:/var/www
|
||||
networks:
|
||||
- server
|
||||
container_name: php83
|
||||
restart: always
|
||||
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:
|
||||
- 3306:3306
|
||||
- "3306:3306"
|
||||
container_name: mysql
|
||||
mysql8:
|
||||
build:
|
||||
context: mysql8/
|
||||
dockerfile: dockerfile
|
||||
restart: always
|
||||
environment:
|
||||
MYSQL_ROOT_PASSWORD: root
|
||||
command: --default-authentication-plugin=mysql_native_password
|
||||
networks:
|
||||
- server
|
||||
ports:
|
||||
- "3306:3306"
|
||||
container_name: mysql8
|
||||
redis:
|
||||
build:
|
||||
context: ./redis/
|
||||
@ -41,7 +97,30 @@ services:
|
||||
# volumes:
|
||||
# - ${REDIS_DATA_PATH}:/data
|
||||
ports:
|
||||
- 6379:6379
|
||||
- "6379:6379"
|
||||
container_name: redis
|
||||
python:
|
||||
build:
|
||||
context: ./python/
|
||||
dockerfile: dockerfile
|
||||
volumes:
|
||||
- ${LOCAL_CODE_ROOT}:/code
|
||||
networks:
|
||||
- server
|
||||
container_name: python
|
||||
ports:
|
||||
- "8000:8000"
|
||||
node:
|
||||
build:
|
||||
context: ./node/
|
||||
dockerfile: dockerfile
|
||||
volumes:
|
||||
- ${LOCAL_CODE_ROOT}:/code
|
||||
networks:
|
||||
- server
|
||||
stdin_open: true # docker run -i
|
||||
tty: true # docker run -t
|
||||
ipc: host
|
||||
container_name: node
|
||||
networks:
|
||||
server:
|
@ -1,2 +1 @@
|
||||
FROM mysql:5.7
|
||||
MAINTAINER tradewind
|
||||
|
1
mysql8/dockerfile
Normal file
1
mysql8/dockerfile
Normal file
@ -0,0 +1 @@
|
||||
FROM mysql:8.0
|
10
mysql8/sources.list
Normal file
10
mysql8/sources.list
Normal file
@ -0,0 +1,10 @@
|
||||
deb http://mirrors.aliyun.com/ubuntu/ bionic main restricted universe multiverse
|
||||
deb http://mirrors.aliyun.com/ubuntu/ bionic-security main restricted universe multiverse
|
||||
deb http://mirrors.aliyun.com/ubuntu/ bionic-updates main restricted universe multiverse
|
||||
deb http://mirrors.aliyun.com/ubuntu/ bionic-proposed main restricted universe multiverse
|
||||
deb http://mirrors.aliyun.com/ubuntu/ bionic-backports main restricted universe multiverse
|
||||
deb-src http://mirrors.aliyun.com/ubuntu/ bionic main restricted universe multiverse
|
||||
deb-src http://mirrors.aliyun.com/ubuntu/ bionic-security main restricted universe multiverse
|
||||
deb-src http://mirrors.aliyun.com/ubuntu/ bionic-updates main restricted universe multiverse
|
||||
deb-src http://mirrors.aliyun.com/ubuntu/ bionic-proposed main restricted universe multiverse
|
||||
deb-src http://mirrors.aliyun.com/ubuntu/ bionic-backports main restricted universe multiverse
|
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 php74: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
|
17
node/dockerfile
Normal file
17
node/dockerfile
Normal file
@ -0,0 +1,17 @@
|
||||
FROM node:latest
|
||||
|
||||
|
||||
RUN apt-get update && apt-get install -y \
|
||||
libgtkextra-dev \
|
||||
libgconf2-dev \
|
||||
libnss3 \
|
||||
libasound2 \
|
||||
libxtst-dev \
|
||||
libxss1 \
|
||||
libatk-bridge2.0-0 \
|
||||
libgtk-3.0 \
|
||||
libgbm-dev \
|
||||
&& apt-get clean \
|
||||
&& apt-get autoclean
|
||||
|
||||
|
5
php7.1/docker-php-ext-xdebug.ini
Normal file
5
php7.1/docker-php-ext-xdebug.ini
Normal file
@ -0,0 +1,5 @@
|
||||
zend_extension=/usr/local/lib/php/extensions/no-debug-non-zts-20160303/xdebug.so
|
||||
xdebug.mode=debug
|
||||
xdebug.client_host=host.docker.internal
|
||||
xdebug.client_port=9003
|
||||
xdebug.idekey=PHPSTORM
|
48
php7.1/dockerfile
Normal file
48
php7.1/dockerfile
Normal file
@ -0,0 +1,48 @@
|
||||
FROM php:7.1-fpm
|
||||
|
||||
#ARG PROJECT_PATH
|
||||
#WORKDIR ${PROJECT_PATH}
|
||||
|
||||
WORKDIR /opt/project
|
||||
|
||||
RUN sed -i "s@http://deb.debian.org@http://mirrors.tencent.com@g" /etc/apt/sources.list
|
||||
|
||||
RUN apt-get update && apt-get install -y \
|
||||
git \
|
||||
zip \
|
||||
unzip \
|
||||
libpq-dev \
|
||||
libzip-dev \
|
||||
libpng-dev \
|
||||
libfreetype6-dev \
|
||||
libxml2-dev \
|
||||
libicu-dev \
|
||||
libjpeg62-turbo-dev \
|
||||
&& docker-php-ext-configure intl \
|
||||
&& docker-php-ext-configure pcntl --enable-pcntl \
|
||||
&& docker-php-ext-install -j$(nproc) \
|
||||
bcmath \
|
||||
pdo_mysql \
|
||||
pdo_pgsql \
|
||||
gd \
|
||||
zip \
|
||||
exif \
|
||||
sockets \
|
||||
intl \
|
||||
soap \
|
||||
pcntl \
|
||||
&& pecl install \
|
||||
redis \
|
||||
xdebug-2.9.8 \
|
||||
# mongodb \
|
||||
&& docker-php-ext-enable \
|
||||
redis \
|
||||
xdebug \
|
||||
# mongodb \
|
||||
&& apt-get clean \
|
||||
&& apt-get autoclean
|
||||
|
||||
RUN curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer
|
||||
|
||||
# 修改 composer 为国内镜像
|
||||
RUN composer config -g repo.packagist composer https://mirrors.cloud.tencent.com/composer/
|
1947
php7.1/php.ini
Normal file
1947
php7.1/php.ini
Normal file
File diff suppressed because it is too large
Load Diff
10
php7.1/sources.list
Normal file
10
php7.1/sources.list
Normal file
@ -0,0 +1,10 @@
|
||||
deb https://mirrors.tuna.tsinghua.edu.cn/debian/ bullseye main contrib non-free
|
||||
# deb-src https://mirrors.tuna.tsinghua.edu.cn/debian/ bullseye main contrib non-free
|
||||
deb https://mirrors.tuna.tsinghua.edu.cn/debian/ bullseye-updates main contrib non-free
|
||||
# deb-src https://mirrors.tuna.tsinghua.edu.cn/debian/ bullseye-updates main contrib non-free
|
||||
|
||||
deb https://mirrors.tuna.tsinghua.edu.cn/debian/ bullseye-backports main contrib non-free
|
||||
# deb-src https://mirrors.tuna.tsinghua.edu.cn/debian/ bullseye-backports main contrib non-free
|
||||
|
||||
deb https://mirrors.tuna.tsinghua.edu.cn/debian-security bullseye-security main contrib non-free
|
||||
# deb-src https://mirrors.tuna.tsinghua.edu.cn/debian-security bullseye-security main contrib non-free
|
5
php7.4/docker-php-ext-xdebug.ini
Normal file
5
php7.4/docker-php-ext-xdebug.ini
Normal file
@ -0,0 +1,5 @@
|
||||
zend_extension=xdebug
|
||||
xdebug.mode=debug
|
||||
xdebug.client_host=host.docker.internal
|
||||
xdebug.client_port=9003
|
||||
xdebug.idekey=PHPSTORM
|
@ -1,44 +1,47 @@
|
||||
FROM php:7.4-fpm-alpine
|
||||
FROM php:7.4-fpm
|
||||
|
||||
MAINTAINER tradewind
|
||||
RUN sed -i "s@http://deb.debian.org@http://mirrors.aliyun.com@g" /etc/apt/sources.list
|
||||
|
||||
RUN sed -i 's/dl-cdn.alpinelinux.org/mirrors.aliyun.com/g' /etc/apk/repositories
|
||||
|
||||
RUN apk add --no-cache --virtual .build-deps \
|
||||
$PHPIZE_DEPS \
|
||||
curl-dev \
|
||||
imagemagick-dev \
|
||||
libtool \
|
||||
libxml2-dev \
|
||||
postgresql-dev \
|
||||
sqlite-dev \
|
||||
libzip-dev \
|
||||
&& apk add --no-cache \
|
||||
curl \
|
||||
RUN apt-get update && apt-get install -y \
|
||||
git \
|
||||
imagemagick \
|
||||
mysql-client \
|
||||
postgresql-libs \
|
||||
openssl \
|
||||
&& pecl install imagick \
|
||||
&& docker-php-ext-enable imagick \
|
||||
&& pecl install xdebug-3.0.4 \
|
||||
&& docker-php-ext-enable xdebug \
|
||||
&& docker-php-ext-install \
|
||||
curl \
|
||||
iconv \
|
||||
pdo \
|
||||
zip \
|
||||
unzip \
|
||||
libpq-dev \
|
||||
libzip-dev \
|
||||
libpng-dev \
|
||||
libfreetype6-dev \
|
||||
libxml2-dev \
|
||||
libicu-dev \
|
||||
libjpeg62-turbo-dev \
|
||||
libssl-dev \
|
||||
librdkafka-dev \
|
||||
&& docker-php-ext-configure intl \
|
||||
&& docker-php-ext-configure pcntl --enable-pcntl \
|
||||
&& docker-php-ext-install -j$(nproc) \
|
||||
bcmath \
|
||||
pdo_mysql \
|
||||
pdo_pgsql \
|
||||
pdo_sqlite \
|
||||
pcntl \
|
||||
tokenizer \
|
||||
xml \
|
||||
gd \
|
||||
zip \
|
||||
&& curl -s https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin/ --filename=composer \
|
||||
&& apk del -f .build-deps
|
||||
exif \
|
||||
sockets \
|
||||
intl \
|
||||
soap \
|
||||
pcntl \
|
||||
&& pecl install \
|
||||
redis \
|
||||
xdebug-3.1.6 \
|
||||
mongodb-1.12.0 \
|
||||
rdkafka-4.1.2 \
|
||||
&& docker-php-ext-enable \
|
||||
redis \
|
||||
xdebug \
|
||||
mongodb \
|
||||
rdkafka \
|
||||
&& apt-get clean \
|
||||
&& apt-get autoclean
|
||||
|
||||
RUN curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer
|
||||
|
||||
# 修改 composer 为国内镜像
|
||||
RUN composer config -g repo.packagist composer https://packagist.laravel-china.org
|
||||
|
||||
WORKDIR /var/www
|
||||
RUN composer config -g repo.packagist composer https://mirrors.cloud.tencent.com/composer/
|
||||
|
1947
php7.4/php.ini
Normal file
1947
php7.4/php.ini
Normal file
File diff suppressed because it is too large
Load Diff
1947
php7.4/php.ini-dev
Normal file
1947
php7.4/php.ini-dev
Normal file
File diff suppressed because it is too large
Load Diff
@ -1,10 +1,10 @@
|
||||
deb http://mirrors.aliyun.com/ubuntu/ bionic main restricted universe multiverse
|
||||
deb http://mirrors.aliyun.com/ubuntu/ bionic-security main restricted universe multiverse
|
||||
deb http://mirrors.aliyun.com/ubuntu/ bionic-updates main restricted universe multiverse
|
||||
deb http://mirrors.aliyun.com/ubuntu/ bionic-proposed main restricted universe multiverse
|
||||
deb http://mirrors.aliyun.com/ubuntu/ bionic-backports main restricted universe multiverse
|
||||
deb-src http://mirrors.aliyun.com/ubuntu/ bionic main restricted universe multiverse
|
||||
deb-src http://mirrors.aliyun.com/ubuntu/ bionic-security main restricted universe multiverse
|
||||
deb-src http://mirrors.aliyun.com/ubuntu/ bionic-updates main restricted universe multiverse
|
||||
deb-src http://mirrors.aliyun.com/ubuntu/ bionic-proposed main restricted universe multiverse
|
||||
deb-src http://mirrors.aliyun.com/ubuntu/ bionic-backports main restricted universe multiverse
|
||||
deb https://mirrors.tuna.tsinghua.edu.cn/debian/ bullseye main contrib non-free
|
||||
# deb-src https://mirrors.tuna.tsinghua.edu.cn/debian/ bullseye main contrib non-free
|
||||
deb https://mirrors.tuna.tsinghua.edu.cn/debian/ bullseye-updates main contrib non-free
|
||||
# deb-src https://mirrors.tuna.tsinghua.edu.cn/debian/ bullseye-updates main contrib non-free
|
||||
|
||||
deb https://mirrors.tuna.tsinghua.edu.cn/debian/ bullseye-backports main contrib non-free
|
||||
# deb-src https://mirrors.tuna.tsinghua.edu.cn/debian/ bullseye-backports main contrib non-free
|
||||
|
||||
deb https://mirrors.tuna.tsinghua.edu.cn/debian-security bullseye-security main contrib non-free
|
||||
# deb-src https://mirrors.tuna.tsinghua.edu.cn/debian-security bullseye-security main contrib non-free
|
5
php8.3/docker-php-ext-xdebug.ini
Normal file
5
php8.3/docker-php-ext-xdebug.ini
Normal file
@ -0,0 +1,5 @@
|
||||
zend_extension=xdebug
|
||||
xdebug.mode=debug
|
||||
xdebug.client_host=host.docker.internal
|
||||
xdebug.client_port=9003
|
||||
xdebug.idekey=PHPSTORM
|
41
php8.3/dockerfile
Normal file
41
php8.3/dockerfile
Normal file
@ -0,0 +1,41 @@
|
||||
FROM php:8.3-fpm
|
||||
|
||||
RUN sed -i "s@http://deb.debian.org@http://mirrors.aliyun.com@g" /etc/apt/sources.list.d/debian.sources
|
||||
|
||||
RUN apt-get update && apt-get install -y \
|
||||
git \
|
||||
zip \
|
||||
unzip \
|
||||
libpq-dev \
|
||||
libzip-dev \
|
||||
libpng-dev \
|
||||
libfreetype6-dev \
|
||||
libxml2-dev \
|
||||
libicu-dev \
|
||||
libjpeg62-turbo-dev \
|
||||
&& docker-php-ext-configure intl \
|
||||
&& docker-php-ext-configure pcntl --enable-pcntl \
|
||||
&& docker-php-ext-install -j$(nproc) \
|
||||
bcmath \
|
||||
pdo_mysql \
|
||||
pdo_pgsql \
|
||||
gd \
|
||||
zip \
|
||||
exif \
|
||||
sockets \
|
||||
intl \
|
||||
soap \
|
||||
pcntl \
|
||||
&& pecl install \
|
||||
redis \
|
||||
xdebug \
|
||||
&& docker-php-ext-enable \
|
||||
redis \
|
||||
xdebug \
|
||||
&& apt-get clean \
|
||||
&& apt-get autoclean
|
||||
|
||||
RUN curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer
|
||||
|
||||
# 修改 composer 为国内镜像
|
||||
RUN composer config -g repo.packagist composer https://mirrors.cloud.tencent.com/composer/
|
1947
php8.3/php.ini
Normal file
1947
php8.3/php.ini
Normal file
File diff suppressed because it is too large
Load Diff
1947
php8.3/php.ini-dev
Normal file
1947
php8.3/php.ini-dev
Normal file
File diff suppressed because it is too large
Load Diff
10
php8.3/sources.list
Normal file
10
php8.3/sources.list
Normal file
@ -0,0 +1,10 @@
|
||||
deb https://mirrors.tuna.tsinghua.edu.cn/debian/ bullseye main contrib non-free
|
||||
# deb-src https://mirrors.tuna.tsinghua.edu.cn/debian/ bullseye main contrib non-free
|
||||
deb https://mirrors.tuna.tsinghua.edu.cn/debian/ bullseye-updates main contrib non-free
|
||||
# deb-src https://mirrors.tuna.tsinghua.edu.cn/debian/ bullseye-updates main contrib non-free
|
||||
|
||||
deb https://mirrors.tuna.tsinghua.edu.cn/debian/ bullseye-backports main contrib non-free
|
||||
# deb-src https://mirrors.tuna.tsinghua.edu.cn/debian/ bullseye-backports main contrib non-free
|
||||
|
||||
deb https://mirrors.tuna.tsinghua.edu.cn/debian-security bullseye-security main contrib non-free
|
||||
# deb-src https://mirrors.tuna.tsinghua.edu.cn/debian-security bullseye-security main contrib non-free
|
24
python/dockerfile
Normal file
24
python/dockerfile
Normal file
@ -0,0 +1,24 @@
|
||||
FROM python:3.9-alpine3.13 as build
|
||||
RUN sed -i 's/dl-cdn.alpinelinux.org/mirrors.tuna.tsinghua.edu.cn/g' /etc/apk/repositories \
|
||||
&& apk update \
|
||||
&& apk add git gcc g++ musl-dev libffi-dev libressl-dev make
|
||||
WORKDIR /install
|
||||
COPY requirements.txt /install/requirements.txt
|
||||
RUN pip install -i https://pypi.tuna.tsinghua.edu.cn/simple -r /install/requirements.txt \
|
||||
&& mkdir -p /install/lib/python3.9/site-packages \
|
||||
&& cp -rp /usr/local/lib/python3.9/site-packages /install/lib/python3.9 \
|
||||
&& cp -p /usr/local/bin/uvicorn /install/uvicorn
|
||||
|
||||
|
||||
FROM python:3.9-alpine3.13
|
||||
|
||||
# This hack is widely applied to avoid python printing issues in docker containers.
|
||||
# See: https://github.com/Docker-Hub-frolvlad/docker-alpine-python3/pull/13
|
||||
ENV PYTHONUNBUFFERED=1
|
||||
|
||||
COPY --from=build /install/lib /usr/local/lib
|
||||
COPY --from=build /install/uvicorn /usr/local/bin/uvicorn
|
||||
|
||||
WORKDIR /code
|
||||
|
||||
CMD ["uvicorn", "app.main:app", "--host", "0.0.0.0", "--port", "8000", "--reload"]
|
6
python/requirements.txt
Normal file
6
python/requirements.txt
Normal file
@ -0,0 +1,6 @@
|
||||
fastapi
|
||||
python-multipart
|
||||
python_jose[cryptography]
|
||||
SQLAlchemy[sqlite]
|
||||
uvicorn[standard]
|
||||
passlib[bcrypt]
|
@ -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