* optimizes nginx.conf * better proxy pipelining * optimizes Dockerfile * smaller resulting image * faster rebuilding due to reusing of existing layers * optimizes docker-entrypoint.sh * better startup performance * better compatibility with docker engine
37 lines
1.1 KiB
Docker
37 lines
1.1 KiB
Docker
# Nutze ein schlankes Python-Image
|
|
FROM python:3.11-slim-bullseye
|
|
|
|
ENV PYTHONUNBUFFERED 1
|
|
|
|
WORKDIR /konova
|
|
|
|
# Installiere System-Abhängigkeiten
|
|
RUN apt-get update && apt-get install -y --no-install-recommends \
|
|
gdal-bin redis-server nginx \
|
|
&& rm -rf /var/lib/apt/lists/* # Platz sparen
|
|
|
|
# Erstelle benötigte Verzeichnisse & setze Berechtigungen
|
|
RUN mkdir -p /var/log/nginx /var/log/gunicorn /var/lib/nginx /tmp/nginx_client_body \
|
|
&& touch /var/log/nginx/access.log /var/log/nginx/error.log \
|
|
&& chown -R root:root /var/log/nginx /var/lib/nginx /tmp/nginx_client_body
|
|
|
|
# Kopiere und installiere Python-Abhängigkeiten
|
|
COPY ./requirements.txt /konova/
|
|
RUN pip install --upgrade pip && pip install --no-cache-dir -r requirements.txt
|
|
|
|
# Entferne Standard-Nginx-Site und ersetze sie durch eigene Config
|
|
RUN rm -rf /etc/nginx/sites-enabled/default
|
|
COPY ./nginx.conf /etc/nginx/conf.d
|
|
|
|
# Kopiere restliche Projektdateien
|
|
COPY . /konova/
|
|
|
|
# Sammle statische Dateien
|
|
RUN python manage.py collectstatic --noinput
|
|
|
|
# Exponiere Ports
|
|
#EXPOSE 80 6379 8000
|
|
|
|
# Setze Entrypoint
|
|
ENTRYPOINT ["/konova/docker-entrypoint.sh"]
|