60 lines
2.5 KiB
Docker
60 lines
2.5 KiB
Docker
ARG PYTHON_VERSION
|
|
ARG NODE_VERSION
|
|
ARG NPM_VERSION
|
|
FROM python:${PYTHON_VERSION} AS prod
|
|
RUN ln -sf /usr/share/zoneinfo/Europe/Berlin /etc/localtime
|
|
RUN apt-get clean && apt-get update && apt-get install -y locales
|
|
RUN echo "de_DE.UTF-8 UTF-8" >> /etc/locale.gen
|
|
RUN locale-gen
|
|
# Das Verzeichnis /usr/opt/pythonapp/env wird als Python-Umgebung (venv) verwendet.
|
|
# Es wird bewusst außerhalb des Verzeichnisses /usr/opt/pythonapp/App_Server erstellt,
|
|
# um die Python-Umgebung von den Anwendungsdateien zu trennen und das Virtual Environment nicht auf dem Host zu zeigen.
|
|
RUN mkdir -p /usr/opt/pythonapp/App_Server/root /usr/opt/pythonapp/env /usr/var/pythonappdata
|
|
WORKDIR /usr/opt/pythonapp
|
|
RUN python -m venv --upgrade-deps /usr/opt/pythonapp/env
|
|
COPY root/requirements.txt /usr/opt/pythonapp/App_Server/root/requirements.txt
|
|
RUN /usr/opt/pythonapp/env/bin/pip install --no-cache-dir --upgrade pip -r /usr/opt/pythonapp/App_Server/root/requirements.txt
|
|
# COPY scripts/init.sh /init.sh
|
|
# RUN chmod 552 /init.sh
|
|
|
|
# # ENTRYPOINT [ "/init.sh" ]
|
|
# ENTRYPOINT [ "sh", "/init.sh" ]
|
|
# CMD []
|
|
|
|
FROM prod AS dev
|
|
ARG NODE_VERSION
|
|
ARG NPM_VERSION
|
|
|
|
# --- 2. Systemabhängigkeiten (für Python + Node.js) ---
|
|
RUN apt-get update && \
|
|
apt-get install -y --no-install-recommends \
|
|
git \
|
|
curl \
|
|
procps \
|
|
build-essential \
|
|
libpq-dev \
|
|
libfreetype6-dev \
|
|
libjpeg62-turbo-dev \
|
|
libxml2-dev \
|
|
libxslt1-dev \
|
|
sqlite3 \
|
|
&& rm -rf /var/lib/apt/lists/*
|
|
|
|
# --- 3. Node.js + npm installieren ---
|
|
|
|
RUN curl -fsSL https://deb.nodesource.com/setup_${NODE_VERSION}.x | bash - && \
|
|
apt-get install -y nodejs && \
|
|
npm install -g npm@${NPM_VERSION}
|
|
|
|
# --- 8. Arbeitsverzeichnis für TypeScript ---
|
|
# In dem Entwicklungsverzeichnis (PYTHON_DEV_DIR) existiert dies schon als Unterverzeichnis "Client", daher wird es hier nicht erstellt
|
|
|
|
# --- 9. TypeScript + Rollup installieren ---
|
|
# Das Script inittypescriptdev.sh wird in der Entwicklungsumgebung ausgeführt, um die TypeScript-Umgebung zu initialisieren.
|
|
# Daher ist es nicht notwendig, es hier zu kopieren und auszuführen.
|
|
# COPY ./scripts/inittypescriptdev.sh /usr/opt/pythonapp/App_Server/scripts/inittypescriptdev.sh
|
|
# RUN chmod +x /usr/opt/pythonapp/App_Server/scripts/inittypescriptdev.sh
|
|
ENTRYPOINT ["sh", "/usr/opt/pythonapp/App_Server/scripts/inittypescriptdev.sh"]
|
|
CMD ["/usr/opt/pythonapp/env/bin/python", "root/runserver.py", "-D"]
|
|
|