Skip to content

Commit 4bfafcd

Browse files
committed
Update docker scripts
1 parent 0966152 commit 4bfafcd

File tree

5 files changed

+26
-23
lines changed

5 files changed

+26
-23
lines changed

backend/backend.dockerfile

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
FROM python:3.10-slim
22

3+
SHELL ["/bin/bash", "-c"]
4+
35
WORKDIR /fba
46

57
COPY . .
@@ -9,13 +11,13 @@ RUN sed -i 's/deb.debian.org/mirrors.ustc.edu.cn/g' /etc/apt/sources.list.d/debi
911

1012
RUN apt-get update \
1113
&& apt-get install -y --no-install-recommends gcc python3-dev \
12-
&& rm -rf /var/lib/apt/lists/*
13-
14-
# 某些包可能存在同步不及时导致安装失败的情况,可更改为官方源:https://pypi.org/simple
15-
RUN curl -LsSf https://astral.sh/uv/install.sh | sh \
16-
&& uv sync --group server --default-index https://mirrors.aliyun.com/pypi/simple
14+
&& rm -rf /var/lib/apt/lists/* \
15+
# 某些包可能存在同步不及时导致安装失败的情况,可更改为官方源:https://pypi.org/simple
16+
&& pip install --upgrade pip -i https://mirrors.aliyun.com/pypi/simple \
17+
&& pip install -r backend/requirements.txt -i https://mirrors.aliyun.com/pypi/simple \
18+
&& pip install gunicorn aio_pika supervisor wait-for-it -i https://mirrors.aliyun.com/pypi/simple
1719

18-
ENV TZ = Asia/Shanghai
20+
ENV TZ="Asia/Shanghai"
1921

2022
RUN mkdir -p /var/log/fastapi_server
2123

backend/celery.dockerfile

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
FROM python:3.10-slim
22

3+
SHELL ["/bin/bash", "-c"]
4+
35
WORKDIR /fba
46

57
COPY . .
@@ -10,11 +12,12 @@ RUN sed -i 's/deb.debian.org/mirrors.ustc.edu.cn/g' /etc/apt/sources.list.d/debi
1012
RUN apt-get update \
1113
&& apt-get install -y --no-install-recommends gcc python3-dev \
1214
&& rm -rf /var/lib/apt/lists/* \
15+
# 某些包可能存在同步不及时导致安装失败的情况,可更改为官方源:https://pypi.org/simple
16+
&& pip install --upgrade pip -i https://mirrors.aliyun.com/pypi/simple \
17+
&& pip install -r backend/requirements.txt -i https://mirrors.aliyun.com/pypi/simple \
18+
&& pip install gunicorn aio_pika supervisor wait-for-it -i https://mirrors.aliyun.com/pypi/simple
1319

14-
RUN curl -LsSf https://astral.sh/uv/install.sh | sh \
15-
&& uv sync --group server --default-index https://mirrors.aliyun.com/pypi/simple
16-
17-
ENV TZ = Asia/Shanghai
20+
ENV TZ="Asia/Shanghai"
1821

1922
RUN mkdir -p /var/log/celery
2023

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
11
# Docker
22
DOCKER_MYSQL_MAP_PORT=13306
3+
DOCKER_POSTGRES_MAP_PORT=15432
34
DOCKER_REDIS_MAP_PORT=16379

deploy/backend/docker-compose/.env.server

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,11 @@
11
# Env: dev、pro
22
ENVIRONMENT='dev'
3-
# MySQL
4-
MYSQL_HOST='fba_mysql'
5-
MYSQL_PORT=3306
6-
MYSQL_USER='root'
7-
MYSQL_PASSWORD='123456'
3+
# Database
4+
DATABASE_TYPE='mysql'
5+
DATABASE_HOST='fba_mysql'
6+
DATABASE_PORT=3306
7+
DATABASE_USER='root'
8+
DATABASE_PASSWORD='123456'
89
# Redis
910
REDIS_HOST='fba_redis'
1011
REDIS_PORT=6379

deploy/backend/docker-compose/docker-compose.yml

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
version: "3.10"
2-
31
networks:
42
fba_network:
53
name: fba_network
@@ -42,7 +40,7 @@ services:
4240
wait-for-it -s fba_mysql:3306 -s fba_redis:6379 -t 300
4341
mkdir -p /var/log/supervisor/
4442
supervisord -c /fba/deploy/backend/supervisor.conf
45-
supervisorctl restart fastapi_server
43+
supervisorctl restart
4644
4745
fba_mysql:
4846
image: mysql:8.0.29
@@ -67,15 +65,15 @@ services:
6765
# fba_postgres:
6866
# image: postgres:16
6967
# ports:
70-
# - "${DOCKER_MYSQL_MAP_PORT:-5432}:5432"
68+
# - "${DOCKER_POSTGRES_MAP_PORT:-5432}:5432"
7169
# container_name: fba_postgres
7270
# restart: always
7371
# environment:
7472
# POSTGRES_DB: fba
7573
# POSTGRES_PASSWORD: 123456
7674
# TZ: Asia/Shanghai
7775
# volumes:
78-
# - fba_mysql:/var/lib/postgresql/data
76+
# - fba_postgres:/var/lib/postgresql/data
7977
# networks:
8078
# - fba_network
8179

@@ -165,6 +163,4 @@ services:
165163
wait-for-it -s fba_rabbitmq:5672 -t 300
166164
mkdir -p /var/log/supervisor/
167165
supervisord -c /fba/deploy/backend/supervisor.conf
168-
supervisorctl restart celery_worker
169-
supervisorctl restart celery_beat
170-
supervisorctl restart celery_flower
166+
supervisorctl restart

0 commit comments

Comments
 (0)