Hawoly
commited on
Commit
·
53bbb3a
1
Parent(s):
4ff0f4c
Add git installation to Dockerfile
Browse files- Dockerfile +15 -2
Dockerfile
CHANGED
@@ -1,14 +1,27 @@
|
|
1 |
FROM python:3.10-slim
|
2 |
|
|
|
|
|
|
|
|
|
|
|
|
|
3 |
RUN useradd user
|
4 |
USER user
|
5 |
ENV HOME=/home/user \
|
6 |
PATH=/home/user/.local/bin:$PATH
|
7 |
|
|
|
8 |
WORKDIR $HOME/app
|
9 |
|
10 |
-
|
|
|
11 |
|
|
|
12 |
RUN pip install --no-cache-dir -r requirements.txt
|
13 |
|
14 |
-
|
|
|
|
|
|
|
|
|
|
1 |
FROM python:3.10-slim
|
2 |
|
3 |
+
# Installer git
|
4 |
+
RUN apt-get update && apt-get install -y \
|
5 |
+
git \
|
6 |
+
&& rm -rf /var/lib/apt/lists/*
|
7 |
+
|
8 |
+
# Créer un utilisateur non-root
|
9 |
RUN useradd user
|
10 |
USER user
|
11 |
ENV HOME=/home/user \
|
12 |
PATH=/home/user/.local/bin:$PATH
|
13 |
|
14 |
+
# Définir le répertoire de travail
|
15 |
WORKDIR $HOME/app
|
16 |
|
17 |
+
# Copier le fichier des dépendances
|
18 |
+
COPY --chown=user ./ /home/user/app
|
19 |
|
20 |
+
# Installer les dépendances Python
|
21 |
RUN pip install --no-cache-dir -r requirements.txt
|
22 |
|
23 |
+
# Exposer le port sur lequel FastAPI sera accessible
|
24 |
+
EXPOSE 8000
|
25 |
+
|
26 |
+
# Définir la commande par défaut pour démarrer l'application
|
27 |
+
CMD ["uvicorn", "main:app", "--host", "0.0.0.0", "--port", "8000"]
|