-
Notifications
You must be signed in to change notification settings - Fork 12
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
f80de2c
commit 1b89e1c
Showing
6 changed files
with
201 additions
and
14 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,76 @@ | ||
__pycache__/ | ||
*.py[cod] | ||
*$py.class | ||
*.so | ||
.Python | ||
build/ | ||
develop-eggs/ | ||
dist/ | ||
downloads/ | ||
eggs/ | ||
.eggs/ | ||
lib/ | ||
lib64/ | ||
parts/ | ||
sdist/ | ||
var/ | ||
wheels/ | ||
share/python-wheels/ | ||
*.egg-info/ | ||
.installed.cfg | ||
*.egg | ||
MANIFEST | ||
*.manifest | ||
*.spec | ||
pip-log.txt | ||
pip-delete-this-directory.txt | ||
htmlcov/ | ||
.tox/ | ||
.nox/ | ||
.coverage | ||
.coverage.* | ||
.cache | ||
nosetests.xml | ||
coverage.xml | ||
*.cover | ||
*.py,cover | ||
.hypothesis/ | ||
.pytest_cache/ | ||
cover/ | ||
*.mo | ||
*.pot | ||
*.log | ||
local_settings.py | ||
db.sqlite3 | ||
db.sqlite3-journal | ||
instance/ | ||
.webassets-cache | ||
.scrapy | ||
docs/_build/ | ||
.pybuilder/ | ||
target/ | ||
.ipynb_checkpoints | ||
profile_default/ | ||
ipython_config.py | ||
.pdm.toml | ||
__pypackages__/ | ||
celerybeat-schedule | ||
celerybeat.pid | ||
*.sage.py | ||
.env | ||
.venv | ||
env/ | ||
venv/ | ||
ENV/ | ||
env.bak/ | ||
venv.bak/ | ||
.spyderproject | ||
.spyproject | ||
.ropeproject | ||
/site | ||
.mypy_cache/ | ||
.dmypy.json | ||
dmypy.json | ||
.pyre/ | ||
.pytype/ | ||
cython_debug/ |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
# 第一阶段:使用 Poetry 安装依赖 | ||
FROM python:3.11-rc-slim as builder | ||
|
||
WORKDIR /app | ||
|
||
RUN pip install poetry | ||
|
||
COPY poetry.lock pyproject.toml /app/ | ||
# TODO: login docker register plugin | ||
# 安装依赖,忽略项目本身 | ||
RUN poetry config virtualenvs.create false \ | ||
&& poetry install --no-dev --no-root | ||
|
||
# 第二阶段:构建最终镜像 | ||
FROM python:3.11-rc-slim | ||
|
||
WORKDIR /app | ||
|
||
# 从 builder 阶段复制安装好的依赖 | ||
COPY --from=builder /usr/local/lib/python3.11/site-packages /usr/local/lib/python3.11/site-packages | ||
COPY --from=builder /usr/local/bin /usr/local/bin | ||
|
||
# 复制整个项目到容器中 | ||
COPY . /app | ||
|
||
# 设置环境变量 | ||
ENV PORT=5000 | ||
|
||
# 暴露端口 | ||
EXPOSE 5000 | ||
|
||
# 运行 FastAPI 应用 | ||
CMD ["uvicorn", "src.app.main:app", "--host", "0.0.0.0", "--port", "5000"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters