-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
47 lines (36 loc) · 1.16 KB
/
Copy pathDockerfile
File metadata and controls
47 lines (36 loc) · 1.16 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
41
42
43
44
45
FROM ghcr.io/astral-sh/uv:python3.12-bookworm-slim
RUN apt-get update && \
apt-get install -y --no-install-recommends \
ca-certificates \
cmake \
build-essential \
gcc \
g++ \
curl \
git \
libomp-dev && \
# clean
apt-get autoremove -y && apt-get clean && \
rm -rf /usr/local/src/*
# Créer un utilisateur non-root
RUN useradd -m -u 1000 appuser
ENV PATH="/home/appuser/.local/bin:$PATH"
ENV UV_SYSTEM_PYTHON=1
# Créer dossier app
WORKDIR /workspace
# Copier uniquement les fichiers de dépendances pour optimiser le cache
COPY --chown=appuser pyproject.toml uv.lock ./
RUN uv sync --frozen --no-cache --no-dev
# Copier tout le code source + dossiers nécessaires
COPY --chown=appuser app/ ./app/
COPY --chown=appuser models/ ./models/
COPY --chown=appuser pages/ ./pages/
# Changer les droits et passer en utilisateur non-root
RUN mkdir -p ./pages/__marimo__ && \
chown -R appuser:appuser /workspace && \
chmod -R 755 /workspace
USER appuser
ENV PORT=7860
EXPOSE 7860
#CMD ["uv", "run", "app/main.py"]
CMD ["uv", "run", "uvicorn", "app.main:app", "--host", "0.0.0.0", "--port", "7860"]