NilEneb commited on
Commit
af1dbf0
·
verified ·
1 Parent(s): 3f2e464

Create Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +39 -0
Dockerfile ADDED
@@ -0,0 +1,39 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Verwende Python 3.11 slim als Basis-Image
2
+ FROM python:3.11-slim
3
+
4
+ # Setze Arbeitsverzeichnis
5
+ WORKDIR /app
6
+
7
+ # Installiere System-Dependencies für PostgreSQL, Git und curl
8
+ RUN apt-get update && apt-get install -y \
9
+ build-essential \
10
+ libpq-dev \
11
+ git \
12
+ curl \
13
+ && rm -rf /var/lib/apt/lists/*
14
+
15
+ # Klone das Repository direkt in den Container
16
+ RUN git clone https://github.com/JayJay889/CODE-Network.git . && \
17
+ git checkout main
18
+
19
+ # Installiere Python Dependencies
20
+ RUN pip install --no-cache-dir -r requirements.txt
21
+
22
+ # Erstelle einen non-root User für Sicherheit
23
+ RUN useradd -m -u 1000 appuser && chown -R appuser:appuser /app
24
+ USER appuser
25
+
26
+ # Setze Umgebungsvariablen
27
+ ENV FLASK_APP=app.py
28
+ ENV FLASK_ENV=production
29
+ ENV PYTHONUNBUFFERED=1
30
+
31
+ # Exponiere Port 7860 für Hugging Face Spaces
32
+ EXPOSE 7860
33
+
34
+ # Gesundheitscheck
35
+ HEALTHCHECK --interval=30s --timeout=30s --start-period=5s --retries=3 \
36
+ CMD curl -f http://localhost:7860/ || exit 1
37
+
38
+ # Starte die Anwendung
39
+ CMD ["python", "app.py"]