restructuring

This commit is contained in:
2026-07-17 15:14:16 +01:00
parent 6f1c8cd8ff
commit a9a3cf69c6
6 changed files with 13 additions and 4 deletions
+31
View File
@@ -0,0 +1,31 @@
FROM python:3.12
ENV PYTHONUNBUFFERED 1
#ENV ALLOWED_HOSTS 'django.tryton.geeraert.eu'
#ENV DEBUG 'True'
ARG ALLOWED_HOSTS
ARG DEBUG
ENV ALLOWED_HOSTS=$ALLOWED_HOSTS
ENV DEBUG=$DEBUG
WORKDIR /code/
# Copy only the requirements file first (Changes infrequently)
COPY requirements.txt ./
RUN pip install --cache-dir=/opt/hostedtoolcache/pip --upgrade pip
RUN pip list --cache-dir=/opt/hostedtoolcache/pip --outdated
RUN pip install --cache-dir=/opt/hostedtoolcache/pip --upgrade wheel
RUN pip install --cache-dir=/opt/hostedtoolcache/pip --upgrade setuptools
RUN pip install --cache-dir=/opt/hostedtoolcache/pip -r requirements.txt
# Copy the rest of your application code (Changes frequently, invalidates subsequent cache)
COPY . ./
COPY entrypoint.sh /code/entrypoint.sh
RUN chmod +x /code/entrypoint.sh
ENTRYPOINT ["/code/entrypoint.sh"]
+5
View File
@@ -0,0 +1,5 @@
#!/bin/bash
python django_code/manage.py runserver "0.0.0.0:8000"
+32
View File
@@ -0,0 +1,32 @@
# Stage 1: Build the module
FROM python:3.12
MAINTAINER pi-ux-ce
ENV PYTHONUNBUFFERED 1
ENV ALLOWED_HOSTS 'django-testing.tryton.geeraert.eu'
ENV DEBUG 'True'
WORKDIR /code/
# Install build tools and MaxMind library
RUN apt-get update && \
apt-get install -y git nano && \
rm -rf /var/lib/apt/lists/*
# Clone the project
RUN git clone -b testing https://gitea.tryton.geeraert.eu/pi-ux-ce/Django_kube.git
RUN pip install --cache-dir=/opt/hostedtoolcache/pip --upgrade pip
RUN pip list --cache-dir=/opt/hostedtoolcache/pip --outdated
RUN pip install --cache-dir=/opt/hostedtoolcache/pip --upgrade wheel
RUN pip install --cache-dir=/opt/hostedtoolcache/pip --upgrade setuptools
RUN pip install --cache-dir=/opt/hostedtoolcache/pip -r Django_kube/requirements.txt
COPY entrypoint.sh /code/entrypoint.sh
RUN chmod +x /code/entrypoint.sh
EXPOSE 8000
ENTRYPOINT ["/code/entrypoint.sh"]
+15
View File
@@ -0,0 +1,15 @@
#!/bin/bash
cd Django_kube
#another methid but needs to rm -rf before
#git clone --depth 1 -b main https://gitea.tryton.geeraert.eu/pi-ux-ce/Django_kube.git
git stash
git pull
pip install -r requirements.txt
python django_code/manage.py migrate
python django_code/manage.py runserver "0.0.0.0:8000"