Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
C
chatbot_order
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Vũ Hoàng Anh
chatbot_order
Commits
566ee233
Commit
566ee233
authored
Jan 26, 2026
by
Vũ Hoàng Anh
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
chore: update docker configuration for production optimization
parent
ac047234
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
43 additions
and
41 deletions
+43
-41
Dockerfile.prod
backend/Dockerfile.prod
+9
-12
Dockerfile.stage
backend/Dockerfile.stage
+0
-29
docker-compose.dev.yml
backend/docker-compose.dev.yml
+0
-0
docker-compose.prod.yml
backend/docker-compose.prod.yml
+34
-0
No files found.
backend/Dockerfile.prod
View file @
566ee233
# Lấy Python 3.11 slim (ít file, nhẹ)
FROM python:3.11-slim
FROM python:3.11-slim
# Thư mục làm việc
WORKDIR /app
WORKDIR /app
ENV PYTHONUNBUFFERED=1 PYTHONDONTWRITEBYTECODE=1
# Copy requirements rồi cài package
ENV PYTHONUNBUFFERED=1
ENV PYTHONDONTWRITEBYTECODE=1
ENV ENV=development
COPY requirements.txt .
COPY requirements.txt .
RUN pip install -r requirements.txt
RUN pip install -r requirements.txt
# Copy code
COPY . .
COPY . .
# Copy entrypoint script (nếu có)
# Expose port 5000 (Port chạy server)
COPY entrypoint.sh /app/entrypoint.sh
RUN chmod +x /app/entrypoint.sh
# Mở port 5000
EXPOSE 5000
EXPOSE 5000
# Chạy server
# Tự động tính số worker = (Số Core * 2) + 1 để tận dụng tối đa CPU
CMD ["/app/entrypoint.sh"]
CMD gunicorn server:app --workers $(( 2 * $(nproc) + 1 )) --worker-class uvicorn.workers.UvicornWorker --bind 0.0.0.0:5000 --timeout 60
\ No newline at end of file
backend/Dockerfile.stage
deleted
100644 → 0
View file @
ac047234
# ============================================================
# DOCKERFILE.STAGE - Development/Staging (Hot Reload)
# ============================================================
# Sử dụng Python 3.11 Slim để tối ưu dung lượng
FROM python:3.11-slim
# Thiết lập thư mục làm việc
WORKDIR /app
# Thiết lập biến môi trường để log in ra ngay lập tức
ENV PYTHONUNBUFFERED=1
ENV PYTHONDONTWRITEBYTECODE=1
ENV ENV=development
# Copy requirements.txt trước để tận dụng Docker cache
COPY requirements.txt .
# Cài đặt thư viện Python (với cache mount)
RUN pip install -r requirements.txt
# Copy toàn bộ source code vào image
COPY . .
# Expose port 5000 (Port chạy server)
EXPOSE 5000
# Lệnh chạy server dùng uvicorn với hot reload
# ⚡ Hot reload - tự động restart khi code thay đổi (dùng cho dev/stage)
CMD ["uvicorn", "server:app", "--host", "0.0.0.0", "--port", "5000", "--reload"]
backend/docker-compose.yml
→
backend/docker-compose.
dev.
yml
View file @
566ee233
File moved
backend/docker-compose.prod.yml
0 → 100644
View file @
566ee233
services
:
# --- Backend Service ---
backend
:
build
:
context
:
.
dockerfile
:
Dockerfile.prod
container_name
:
canifa_backend
env_file
:
.env
ports
:
-
"
5000:5000"
volumes
:
-
.:/app
environment
:
-
PORT=5000
restart
:
unless-stopped
deploy
:
resources
:
limits
:
memory
:
8g
networks
:
-
backend_network
logging
:
driver
:
"
json-file"
options
:
tag
:
"
{{.Name}}"
networks
:
backend_network
:
driver
:
bridge
ipam
:
driver
:
default
config
:
-
subnet
:
"
172.24.0.0/16"
gateway
:
"
172.24.0.1"
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment