Files
Projektarbeit-MYP/Dockerfile.simple
2025-06-20 11:36:53 +02:00

63 lines
1.8 KiB
Docker

# Einfaches Dockerfile für MYP (Manage Your Printers) System
# Mercedes-Benz TBA Marienfelde - Vereinfachte Version
FROM python:3.11-slim-bullseye
LABEL maintainer="Till Tomczak <till.tomczak@mercedes-benz.com>"
LABEL description="MYP - 3D Printer Management System for Mercedes-Benz"
LABEL version="1.0"
# Umgebungsvariablen
ENV PYTHONUNBUFFERED=1
ENV PYTHONDONTWRITEBYTECODE=1
ENV FLASK_ENV=production
ENV MYP_ENV=production
ENV PYTHONPATH=/app
# System-Dependencies für Production
RUN apt-get update && apt-get install -y --no-install-recommends \
curl \
iputils-ping \
sqlite3 \
openssl \
&& rm -rf /var/lib/apt/lists/*
# Arbeitsverzeichnis erstellen
WORKDIR /app
# Python Requirements installieren
COPY backend/requirements.txt /tmp/requirements.txt
RUN pip install --upgrade pip wheel setuptools && \
pip install --no-cache-dir -r /tmp/requirements.txt
# Anwendungs-Code kopieren
COPY backend/ /app/
# Verzeichnisse für Logs, Uploads, Database, etc. erstellen
RUN mkdir -p /app/logs /app/uploads /app/static/uploads /app/instance /app/database && \
chmod -R 755 /app/logs /app/uploads /app/static/uploads /app/instance /app/database
# SSL-Zertifikate-Verzeichnis erstellen
RUN mkdir -p /app/ssl && chmod 755 /app/ssl
# Benutzer für Security erstellen
RUN useradd --create-home --shell /bin/bash myp && \
chown -R myp:myp /app
# Ports exposieren
EXPOSE 80 443 5000
# Health Check
HEALTHCHECK --interval=30s --timeout=10s --start-period=60s --retries=3 \
CMD curl -f http://localhost:5000/ || exit 1
# Startup-Skript
COPY docker-entrypoint.sh /usr/local/bin/
RUN chmod +x /usr/local/bin/docker-entrypoint.sh
# Als myp-Benutzer ausführen
USER myp
# Entry Point
ENTRYPOINT ["/usr/local/bin/docker-entrypoint.sh"]
CMD ["python", "app.py", "--host=0.0.0.0", "--port=5000"]