Compare commits

6 Commits

Author SHA1 Message Date
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
5 changed files with 86 additions and 48 deletions

View File

@@ -16,7 +16,7 @@ services:
- ./log/nginx:/var/log/nginx - ./log/nginx:/var/log/nginx
container_name: nginx container_name: nginx
restart: always restart: always
php7.4: php74:
build: build:
context: ./php7.4/ context: ./php7.4/
dockerfile: dockerfile dockerfile: dockerfile
@@ -55,5 +55,16 @@ services:
ports: ports:
- 6379:6379 - 6379:6379
container_name: redis container_name: redis
python:
build:
context: ./
dockerfile: dockerfile
volumes:
- ${LOCAL_CODE_ROOT}:/code
networks:
- server
container_name: python
ports:
- 8000:8000
networks: networks:
server: server:

View File

@@ -1,42 +1,39 @@
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 RUN sed -i "s@http://deb.debian.org@http://mirrors.aliyun.com@g" /etc/apt/sources.list
RUN apk add --no-cache --virtual .build-deps \ RUN apt-get update && apt-get install -y \
$PHPIZE_DEPS \ git \
curl-dev \ zip \
imagemagick-dev \ unzip \
libtool \ libpq-dev \
libxml2-dev \ libzip-dev \
postgresql-dev \ libpng-dev \
sqlite-dev \ libfreetype6-dev \
&& apk add --no-cache \ libxml2-dev \
curl \ libicu-dev \
git \ libjpeg62-turbo-dev \
imagemagick \ && docker-php-ext-configure intl \
mysql-client \ && docker-php-ext-install -j$(nproc) \
postgresql-libs \ bcmath \
openssl \ pdo_mysql \
libzip-dev \ pdo_pgsql \
&& pecl install imagick \ gd \
&& docker-php-ext-enable imagick \ zip \
&& pecl install xdebug-3.0.4 \ exif \
&& docker-php-ext-enable xdebug \ sockets \
&& docker-php-ext-install \ intl \
curl \ soap \
iconv \ && pecl install \
pdo \ redis \
pdo_mysql \ xdebug \
pdo_pgsql \ && docker-php-ext-enable \
pdo_sqlite \ redis \
pcntl \ xdebug \
tokenizer \ && apt-get clean \
xml \ && apt-get autoclean
zip \
&& curl -s https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin/ --filename=composer \ RUN curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer
&& apk del -f .build-deps
# 修改 composer 为国内镜像 # 修改 composer 为国内镜像
RUN composer config -g repo.packagist composer https://mirrors.cloud.tencent.com/composer/ RUN composer config -g repo.packagist composer https://mirrors.cloud.tencent.com/composer/
WORKDIR /var/www

View File

@@ -1,10 +1,10 @@
deb http://mirrors.aliyun.com/ubuntu/ bionic main restricted universe multiverse deb https://mirrors.tuna.tsinghua.edu.cn/debian/ bullseye main contrib non-free
deb http://mirrors.aliyun.com/ubuntu/ bionic-security main restricted universe multiverse # deb-src https://mirrors.tuna.tsinghua.edu.cn/debian/ bullseye main contrib non-free
deb http://mirrors.aliyun.com/ubuntu/ bionic-updates main restricted universe multiverse deb https://mirrors.tuna.tsinghua.edu.cn/debian/ bullseye-updates main contrib non-free
deb http://mirrors.aliyun.com/ubuntu/ bionic-proposed main restricted universe multiverse # deb-src https://mirrors.tuna.tsinghua.edu.cn/debian/ bullseye-updates main contrib non-free
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 https://mirrors.tuna.tsinghua.edu.cn/debian/ bullseye-backports main contrib non-free
deb-src http://mirrors.aliyun.com/ubuntu/ bionic-security main restricted universe multiverse # deb-src https://mirrors.tuna.tsinghua.edu.cn/debian/ bullseye-backports main contrib non-free
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 https://mirrors.tuna.tsinghua.edu.cn/debian-security bullseye-security main contrib non-free
deb-src http://mirrors.aliyun.com/ubuntu/ bionic-backports main restricted universe multiverse # deb-src https://mirrors.tuna.tsinghua.edu.cn/debian-security bullseye-security main contrib non-free

24
python/dockerfile Normal file
View 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
View File

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