Compare commits

..

10 Commits
test ... master

Author SHA1 Message Date
4b5a861360 #tradewind:add php83 2023-12-25 18:23:07 +08:00
804eb5544f #tradewind:add php71 node 2023-07-19 11:06:25 +08:00
9f308af6b0 #tradewind:add gitignore 2022-11-16 15:23:27 +08:00
c29903b394 #tradewind:update 2022-11-16 15:21:20 +08:00
ddce943c33 #tradewind:update 2022-07-12 15:30:48 +08:00
4a4b03836d #tradewind:update 2021-07-30 11:37:01 +08:00
fd2c7c00dc #tradewind:update 2021-06-25 16:09:49 +08:00
f8cd066ef2 #tradewind:update php repo 2021-06-24 15:50:59 +08:00
0041f06ff1 #tradewind:update php repo 2021-06-24 15:49:21 +08:00
5fa3908c72 #tradewind:update php repo 2021-06-24 15:43:35 +08:00
21 changed files with 10024 additions and 57 deletions

@ -1 +1,2 @@
LOCAL_CODE_ROOT=/var/www/http
LOCAL_CODE_ROOT=/Users/tradewind/Projects
PROJECT_PATH=/Users/tradewind/Projects/example

1
.gitignore vendored

@ -2,3 +2,4 @@
*.iml
log
.env
.DS_Store

@ -6,7 +6,7 @@ services:
context: ./nginx/
dockerfile: dockerfile
ports:
- 80:80
- "80:80"
networks:
- server
volumes:
@ -16,18 +16,49 @@ services:
- ./log/nginx:/var/log/nginx
container_name: nginx
restart: always
php7.4:
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
- ./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/http
networks:
- server
container_name: php74
ports:
- 9000:9000
restart: always
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/http
networks:
- server
container_name: php83
restart: always
mysql:
build:
@ -41,7 +72,7 @@ services:
networks:
- server
ports:
- 3306:3306
- "3306:3306"
container_name: mysql
redis:
build:
@ -53,7 +84,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:

@ -8,7 +8,7 @@ server {
}
location ~ \.php$ {
fastcgi_pass php7.4:9000;
fastcgi_pass php71:9000;
fastcgi_index index.php;
fastcgi_split_path_info ^((?U).+\.php)(/?.+)$;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;

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

@ -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

@ -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

File diff suppressed because it is too large Load Diff

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

@ -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
RUN sed -i 's/dl-cdn.alpinelinux.org/mirrors.aliyun.com/g' /etc/apk/repositories
ARG PROJECT_PATH
RUN apk add --no-cache --virtual .build-deps \
$PHPIZE_DEPS \
curl-dev \
imagemagick-dev \
libtool \
libxml2-dev \
postgresql-dev \
sqlite-dev \
&& apk add --no-cache \
curl \
WORKDIR ${PROJECT_PATH}
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 \
imagemagick \
mysql-client \
postgresql-libs \
openssl \
zip \
unzip \
libpq-dev \
libzip-dev \
&& 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 \
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 \
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 \
&& docker-php-ext-enable \
redis \
xdebug \
# mongodb \
&& apt-get clean \
&& apt-get autoclean
RUN apk --no-cache add shadow && \
usermod -u 1000 www-data && \
groupmod -g 1000 www-data
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.4/php.ini Normal file

File diff suppressed because it is too large Load Diff

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

@ -0,0 +1,5 @@
zend_extension=xdebug
xdebug.mode=debug
xdebug.client_host=host.docker.internal
xdebug.client_port=9003
xdebug.idekey=PHPSTORM

43
php8.3/dockerfile Normal file

@ -0,0 +1,43 @@
FROM php:8.3-fpm
ARG PROJECT_PATH
WORKDIR ${PROJECT_PATH}
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

File diff suppressed because it is too large Load Diff

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

@ -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

@ -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

@ -0,0 +1,6 @@
fastapi
python-multipart
python_jose[cryptography]
SQLAlchemy[sqlite]
uvicorn[standard]
passlib[bcrypt]