-
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
40 lines (32 loc) · 1.07 KB
/
Dockerfile
File metadata and controls
40 lines (32 loc) · 1.07 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
FROM python:3.11-slim
# Cài LibreOffice + fonts tiếng Việt
RUN apt-get update && apt-get install -y --no-install-recommends \
libreoffice \
libreoffice-writer \
fonts-liberation \
fonts-dejavu \
# Fonts hỗ trợ tiếng Việt
fonts-urw-base35 \
# Tránh LibreOffice crash khi headless
libxrender1 libfontconfig1 \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/*
WORKDIR /app
# Copy requirements trước để tận dụng Docker layer cache
COPY requirements.txt .
RUN pip install --no-cache-dir \
--trusted-host pypi.org \
--trusted-host pypi.python.org \
--trusted-host files.pythonhosted.org \
--timeout 120 \
-r requirements.txt
# Bust cache cho app code (thay đổi khi cần force rebuild)
ARG CACHEBUST=1
COPY . .
# Tạo thư mục storage
RUN mkdir -p storage/uploads storage/outputs storage/temp
# Non-root user cho security
RUN useradd -m -u 1000 appuser && chown -R appuser:appuser /app
USER appuser
EXPOSE 8000
CMD ["uvicorn", "app.main:app", "--host", "0.0.0.0", "--port", "8000", "--workers", "4"]