Skip to content

Commit 077db52

Browse files
committed
2025.12.22/18:16
1 parent 3826039 commit 077db52

11 files changed

Lines changed: 189 additions & 128 deletions

.env

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ PROJECT_NAME="Full Stack FastAPI Project"
1717
STACK_NAME=full-stack-fastapi-project
1818

1919
# Backend
20-
BACKEND_CORS_ORIGINS="http://localhost,http://localhost:5173,https://localhost,https://localhost:5173,http://localhost.tiangolo.com"
20+
BACKEND_CORS_ORIGINS="http://localhost,http://localhost:5173,https://localhost,https://localhost:5173,http://localhost.tiangolo.com,https://admin.jprq.live/"
2121
SECRET_KEY=changethis
2222
FIRST_SUPERUSER=admin@example.com
2323
FIRST_SUPERUSER_PASSWORD=changethis

.idea/.gitignore

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

.idea/full-stack-fastapi-template.iml

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

.idea/inspectionProfiles/profiles_settings.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/misc.xml

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

.idea/modules.xml

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

.idea/vcs.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.

backend/Dockerfile

Lines changed: 47 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -1,44 +1,56 @@
1-
FROM python:3.10
1+
FROM python:3.11-slim
22

3+
# --------------------------
4+
# Basic environment
5+
# --------------------------
36
ENV PYTHONUNBUFFERED=1
4-
57
WORKDIR /app/
6-
7-
# Install uv
8-
# Ref: https://docs.astral.sh/uv/guides/integration/docker/#installing-uv
9-
COPY --from=ghcr.io/astral-sh/uv:0.5.11 /uv /uvx /bin/
10-
11-
# Place executables in the environment at the front of the path
12-
# Ref: https://docs.astral.sh/uv/guides/integration/docker/#using-the-environment
13-
ENV PATH="/app/.venv/bin:$PATH"
14-
15-
# Compile bytecode
16-
# Ref: https://docs.astral.sh/uv/guides/integration/docker/#compiling-bytecode
8+
ENV VENV_PATH=/app/.venv
9+
ENV PATH="$VENV_PATH/bin:$PATH"
1710
ENV UV_COMPILE_BYTECODE=1
18-
19-
# uv Cache
20-
# Ref: https://docs.astral.sh/uv/guides/integration/docker/#caching
2111
ENV UV_LINK_MODE=copy
22-
23-
# Install dependencies
24-
# Ref: https://docs.astral.sh/uv/guides/integration/docker/#intermediate-layers
25-
RUN --mount=type=cache,target=/root/.cache/uv \
26-
--mount=type=bind,source=uv.lock,target=uv.lock \
27-
--mount=type=bind,source=pyproject.toml,target=pyproject.toml \
28-
uv sync --frozen --no-install-project
29-
3012
ENV PYTHONPATH=/app
3113

32-
COPY ./scripts /app/scripts
33-
34-
COPY ./pyproject.toml ./uv.lock ./alembic.ini /app/
35-
36-
COPY ./app /app/app
37-
COPY ./tests /app/tests
38-
39-
# Sync the project
40-
# Ref: https://docs.astral.sh/uv/guides/integration/docker/#intermediate-layers
41-
RUN --mount=type=cache,target=/root/.cache/uv \
42-
uv sync
14+
# --------------------------
15+
# Install system dependencies
16+
# --------------------------
17+
RUN apt-get update && apt-get install -y --no-install-recommends \
18+
build-essential \
19+
curl \
20+
&& rm -rf /var/lib/apt/lists/*
21+
22+
# --------------------------
23+
# Install uv runtime
24+
# --------------------------
25+
COPY --from=ghcr.io/astral-sh/uv:0.5.11 /uv /uvx /bin/
4326

27+
# --------------------------
28+
# Create virtual environment
29+
# --------------------------
30+
RUN python -m venv $VENV_PATH
31+
32+
# --------------------------
33+
# Install Python dependencies
34+
# --------------------------
35+
# Copy only lock & project files to leverage Docker caching
36+
COPY pyproject.toml uv.lock /app/
37+
38+
RUN uv sync --frozen --no-install-project
39+
40+
# --------------------------
41+
# Copy scripts, app, and tests
42+
# --------------------------
43+
COPY scripts /app/scripts
44+
COPY app /app/app
45+
COPY tests /app/tests
46+
COPY alembic.ini /app/
47+
48+
# --------------------------
49+
# Final sync
50+
# --------------------------
51+
RUN uv sync
52+
53+
# --------------------------
54+
# Default command
55+
# --------------------------
4456
CMD ["fastapi", "run", "--workers", "4", "app/main.py"]

docker-compose.override.yml

Lines changed: 67 additions & 67 deletions
Original file line numberDiff line numberDiff line change
@@ -5,55 +5,55 @@ services:
55
# http://dashboard.localhost.tiangolo.com: frontend
66
# etc. To enable it, update .env, set:
77
# DOMAIN=localhost.tiangolo.com
8-
proxy:
9-
image: traefik:3.0
10-
volumes:
11-
- /var/run/docker.sock:/var/run/docker.sock
12-
ports:
13-
- "80:80"
14-
- "8090:8080"
15-
# Duplicate the command from docker-compose.yml to add --api.insecure=true
16-
command:
17-
# Enable Docker in Traefik, so that it reads labels from Docker services
18-
- --providers.docker
19-
# Add a constraint to only use services with the label for this stack
20-
- --providers.docker.constraints=Label(`traefik.constraint-label`, `traefik-public`)
21-
# Do not expose all Docker services, only the ones explicitly exposed
22-
- --providers.docker.exposedbydefault=false
23-
# Create an entrypoint "http" listening on port 80
24-
- --entrypoints.http.address=:80
25-
# Create an entrypoint "https" listening on port 443
26-
- --entrypoints.https.address=:443
27-
# Enable the access log, with HTTP requests
28-
- --accesslog
29-
# Enable the Traefik log, for configurations and errors
30-
- --log
31-
# Enable debug logging for local development
32-
- --log.level=DEBUG
33-
# Enable the Dashboard and API
34-
- --api
35-
# Enable the Dashboard and API in insecure mode for local development
36-
- --api.insecure=true
37-
labels:
38-
# Enable Traefik for this service, to make it available in the public network
39-
- traefik.enable=true
40-
- traefik.constraint-label=traefik-public
41-
# Dummy https-redirect middleware that doesn't really redirect, only to
42-
# allow running it locally
43-
- traefik.http.middlewares.https-redirect.contenttype.autodetect=false
44-
networks:
45-
- traefik-public
46-
- default
8+
# proxy:
9+
# image: traefik
10+
# volumes:
11+
# - /var/run/docker.sock:/var/run/docker.sock
12+
# ports:
13+
# - "80:80"
14+
# - "8090:8080"
15+
# # Duplicate the command from docker-compose.yml to add --api.insecure=true
16+
# command:
17+
# # Enable Docker in Traefik, so that it reads labels from Docker services
18+
# - --providers.docker
19+
# # Add a constraint to only use services with the label for this stack
20+
# - --providers.docker.constraints=Label(`traefik.constraint-label`, `traefik-public`)
21+
# # Do not expose all Docker services, only the ones explicitly exposed
22+
# - --providers.docker.exposedbydefault=false
23+
# # Create an entrypoint "http" listening on port 80
24+
# - --entrypoints.http.address=:80
25+
# # Create an entrypoint "https" listening on port 443
26+
# - --entrypoints.https.address=:443
27+
# # Enable the access log, with HTTP requests
28+
# - --accesslog
29+
# # Enable the Traefik log, for configurations and errors
30+
# - --log
31+
# # Enable debug logging for local development
32+
# - --log.level=DEBUG
33+
# # Enable the Dashboard and API
34+
# - --api
35+
# # Enable the Dashboard and API in insecure mode for local development
36+
# - --api.insecure=true
37+
# labels:
38+
# # Enable Traefik for this service, to make it available in the public network
39+
# - traefik.enable=true
40+
# - traefik.constraint-label=traefik-public
41+
# # Dummy https-redirect middleware that doesn't really redirect, only to
42+
# # allow running it locally
43+
# - traefik.http.middlewares.https-redirect.contenttype.autodetect=false
44+
# networks:
45+
# - traefik-public
46+
# - default
4747

4848
db:
4949
restart: "no"
5050
ports:
5151
- "5432:5432"
5252

53-
adminer:
54-
restart: "no"
55-
ports:
56-
- "8080:8080"
53+
# adminer:
54+
# restart: "no"
55+
# ports:
56+
# - "8080:8080"
5757

5858
backend:
5959
restart: "no"
@@ -102,30 +102,30 @@ services:
102102
- VITE_API_URL=http://localhost:8000
103103
- NODE_ENV=development
104104

105-
playwright:
106-
build:
107-
context: ./frontend
108-
dockerfile: Dockerfile.playwright
109-
args:
110-
- VITE_API_URL=http://backend:8000
111-
- NODE_ENV=production
112-
ipc: host
113-
depends_on:
114-
- backend
115-
- mailcatcher
116-
env_file:
117-
- .env
118-
environment:
119-
- VITE_API_URL=http://backend:8000
120-
- MAILCATCHER_HOST=http://mailcatcher:1080
121-
# For the reports when run locally
122-
- PLAYWRIGHT_HTML_HOST=0.0.0.0
123-
- CI=${CI}
124-
volumes:
125-
- ./frontend/blob-report:/app/blob-report
126-
- ./frontend/test-results:/app/test-results
127-
ports:
128-
- 9323:9323
105+
# playwright:
106+
# build:
107+
# context: ./frontend
108+
# dockerfile: Dockerfile.playwright
109+
# args:
110+
# - VITE_API_URL=http://backend:8000
111+
# - NODE_ENV=production
112+
# ipc: host
113+
# depends_on:
114+
# - backend
115+
# - mailcatcher
116+
# env_file:
117+
# - .env
118+
# environment:
119+
# - VITE_API_URL=http://backend:8000
120+
# - MAILCATCHER_HOST=http://mailcatcher:1080
121+
# # For the reports when run locally
122+
# - PLAYWRIGHT_HTML_HOST=0.0.0.0
123+
# - CI=${CI}
124+
# volumes:
125+
# - ./frontend/blob-report:/app/blob-report
126+
# - ./frontend/test-results:/app/test-results
127+
# ports:
128+
# - 9323:9323
129129

130130
networks:
131131
traefik-public:

docker-compose.traefik.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
services:
22
traefik:
3-
image: traefik:3.0
3+
image: traefik
44
ports:
55
# Listen on port 80, default for HTTP, necessary to redirect to HTTPS
66
- 80:80

0 commit comments

Comments
 (0)