Containerize project

add compose for all services to start full project
pull/40/head
Jaronim Pracht 2025-05-27 13:11:32 +02:00
parent 141abc725f
commit 908050a2fb
7 changed files with 59 additions and 21 deletions

View File

@ -0,0 +1,4 @@
API_KEY=
DATABASE_URL=postgresql://admin:admin@db:5432
POSTGRES_PASSWORD=admin
POSTGRES_USER=admin

View File

@ -4,16 +4,18 @@ FROM python:3.11-alpine
# 2. Arbeitsverzeichnis im Container setzen # 2. Arbeitsverzeichnis im Container setzen
WORKDIR /app WORKDIR /app
# 3. requirements.txt kopieren und Pakete installieren # 3. production-style server mit gunicorn
RUN pip install gunicorn
# 4. requirements.txt kopieren und Pakete installieren
COPY requirements.txt . COPY requirements.txt .
RUN pip install --no-cache-dir -r requirements.txt RUN pip install --no-cache-dir -r requirements.txt
# 4. Quellcode kopieren (z.B. app.py)
# 5. Quellcode kopieren (z.B. app.py)
COPY . . COPY . .
# 5. Flask-App starten ENV PYTHONUNBUFFERED=1
# production-style server mit gunicorn EXPOSE 5000
RUN pip install gunicorn
CMD ["gunicorn", "--bind", "0.0.0.0:5000", "app:app"] CMD ["gunicorn", "--bind", "0.0.0.0:5000", "app:app"]

View File

@ -1,14 +0,0 @@
FROM python:3.11-slim
WORKDIR /app
COPY requirements.txt .
RUN pip install --no-cache-dir -r requirements.txt
COPY . .
ENV PYTHONUNBUFFERED=1
EXPOSE 5050
CMD ["python", "app.py"]

View File

@ -7,11 +7,13 @@ RUN apt-get update && apt-get install -y \
build-essential \ build-essential \
&& rm -rf /var/lib/apt/lists/* && rm -rf /var/lib/apt/lists/*
COPY .. /app COPY requirements.txt /app
RUN pip install --upgrade pip RUN pip install --upgrade pip
RUN pip install --no-cache-dir -r requirements.txt RUN pip install --no-cache-dir -r requirements.txt
RUN python -m spacy download en_core_web_sm RUN python -m spacy download en_core_web_sm
COPY .. /app
CMD ["python3.12", "app.py"] CMD ["python3.12", "app.py"]

View File

@ -0,0 +1,44 @@
services:
frontend:
build:
context: frontend
ports:
- 8080:80
db:
image: postgres:17-alpine
env_file:
- .env
# ports:
# - "5432:5432"
healthcheck:
test: ["CMD-SHELL", "pg_isready -U admin"]
interval: 10s
timeout: 5s
retries: 5
coordinator:
build:
context: backend/coordinator
dockerfile: ../../Dockerfile
env_file:
- .env
depends_on:
- db
healthcheck:
test: wget --spider --no-verbose http://127.0.0.1:5000/health || exit 1
interval: 10s
timeout: 5s
retries: 5
ports:
- 5000:5000
spacy:
build:
context: backend/spacy-service
exxeta:
build:
context: backend/exxetaGPT
dockerfile: ../../Dockerfile
env_file:
- .env

Binary file not shown.