Skip to content

Commit 2ab91f5

Browse files
committed
feat: add Dockerfile
1 parent 1b89e1c commit 2ab91f5

9 files changed

Lines changed: 39 additions & 9 deletions

File tree

.dockerignore

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,6 @@ __pypackages__/
5757
celerybeat-schedule
5858
celerybeat.pid
5959
*.sage.py
60-
.env
6160
.venv
6261
env/
6362
venv/

.github/workflows/docker-image.yml

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
name: Build and Push FastAPI Docker Image
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
8+
jobs:
9+
build-and-push:
10+
runs-on: ubuntu-latest
11+
steps:
12+
- name: Checkout code
13+
uses: actions/checkout@v4
14+
15+
- name: Log in to Docker Hub
16+
uses: docker/login-action@v1
17+
with:
18+
username: ${{ secrets.DOCKER_HUB_USERNAME }}
19+
password: ${{ secrets.DOCKER_HUB_ACCESS_TOKEN }}
20+
21+
- name: Build and push Docker image
22+
uses: docker/build-push-action@v2
23+
with:
24+
context: ./
25+
file: ./Dockerfile
26+
push: true
27+
tags: atticuszhou/work-space-fastapi-backend:latest

.idea/deployment.xml

Lines changed: 6 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.idea/fastapi_supabase_template.iml

Lines changed: 0 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.idea/misc.xml

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.idea/modules.xml

Lines changed: 0 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.idea/vcs.xml

Lines changed: 0 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Dockerfile

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ RUN poetry config virtualenvs.create false \
1414
# 第二阶段:构建最终镜像
1515
FROM python:3.11-rc-slim
1616

17+
ENV PYTHONPATH=/app/src
1718
WORKDIR /app
1819

1920
# 从 builder 阶段复制安装好的依赖
@@ -26,6 +27,7 @@ COPY . /app
2627
# 设置环境变量
2728
ENV PORT=5000
2829

30+
2931
# 暴露端口
3032
EXPOSE 5000
3133

README.md

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -52,8 +52,7 @@ ___
5252
3. **pre-commit** for code quality
5353
4. **latest_changes.yml** for auto update README.md
5454
5. **Semantic Release** for auto release and changelog
55-
56-
[//]: # ( 4. **docker** for deployment)
55+
6. **docker** for deployment
5756

5857
## How to use it
5958

@@ -142,8 +141,8 @@ ___
142141
- [ ] websocket with supabase-realtime
143142
- [ ] curd supabase-storage
144143
- [ ] supafunc integration
145-
- [ ] deployment
146-
- [ ] Full **Docker** integration (Docker based).
144+
- [x] deployment
145+
- [x] Full **Docker** integration (Docker based).
147146

148147
## Release Notes 🥸
149148

0 commit comments

Comments
 (0)