Elyon7 commited on
Commit
1859dc4
·
verified ·
1 Parent(s): 62117d3

Update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +13 -9
Dockerfile CHANGED
@@ -1,13 +1,9 @@
1
 
2
- # 1. Base Image
3
  FROM python:3.10-slim
4
 
5
- # 2. Setup Base
6
  ENV DEBIAN_FRONTEND=noninteractive
7
  WORKDIR /App
8
 
9
- # 3. Installa Git, GIT-LFS e librerie grafiche
10
-
11
  RUN apt-get update && apt-get install -y \
12
  git \
13
  git-lfs \
@@ -18,14 +14,22 @@ RUN apt-get update && apt-get install -y \
18
  && rm -rf /var/lib/apt/lists/* \
19
  && git lfs install
20
 
21
- # 4. Configurazione Variabili
22
  EXPOSE 7860
23
  ENV MPLCONFIGDIR=/tmp/matplotlib
24
 
25
- # 5. AVVIO
26
-
27
- CMD git clone https://$GITHUB_TOKEN@github.com/Elyon7/Cosmo-Edu_Lab.git . && \
28
- git lfs pull && \
 
 
 
 
 
 
 
 
 
29
  pip install --no-cache-dir -r requirements.txt && \
30
  cd App && \
31
  python main.py
 
1
 
 
2
  FROM python:3.10-slim
3
 
 
4
  ENV DEBIAN_FRONTEND=noninteractive
5
  WORKDIR /App
6
 
 
 
7
  RUN apt-get update && apt-get install -y \
8
  git \
9
  git-lfs \
 
14
  && rm -rf /var/lib/apt/lists/* \
15
  && git lfs install
16
 
 
17
  EXPOSE 7860
18
  ENV MPLCONFIGDIR=/tmp/matplotlib
19
 
20
+ # Il nuovo CMD: controlla se il codice esiste già prima di clonare
21
+ CMD if [ -d ".git" ]; then \
22
+ echo "Codice già presente, aggiorno all'ultima versione..." && \
23
+ git fetch --all && \
24
+ git reset --hard origin/main && \
25
+ git lfs pull; \
26
+ else \
27
+ echo "Cartella vuota, clono il repository..." && \
28
+ git clone https://$GITHUB_TOKEN@github.com/Elyon7/Cosmo-Edu_Lab.git . && \
29
+ git lfs pull; \
30
+ fi && \
31
+ mkdir -p App/student_submissions && \
32
+ chmod 777 App/student_submissions && \
33
  pip install --no-cache-dir -r requirements.txt && \
34
  cd App && \
35
  python main.py