File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ FROM python:3.12.7
2+
3+ # this is the working directory in the container.
4+ WORKDIR /usr/src/META/Registrering
5+
6+ # this is to prevent python from writing pyc file.
7+ ENV PYTHONDONTWRITEBYTECODE 1
8+ # we add this to prevent python from buffering output to the terminal
9+ ENV PYTHONUNBUFFERED 1
10+ # should we run a upgrade and install? feel free to let me know. RUN pip install --upgrade pip
11+
12+ # As iv understood, this gives us the ability to reads and write to the networking using TCP, or UDP.
13+ RUN apt-get update && apt-get install -y netcat-openbsd && apt-get clean
14+
15+ # this just copies the requirements.txt file into the current directory.
16+ COPY ./requirements.txt .
17+ RUN pip install -r requirements.txt
18+
19+ # copies the entrypoint file.
20+ COPY ./entrypoint.sh .
21+
22+ # this is to make the entrypoint file executable. https://www.gnu.org/software/sed/manual/html_node/The-_0022s_0022-Command.html
23+ RUN sed -i 's/\r $//g' entrypoint.sh
24+
25+ RUN chmod +x entrypoint.sh
26+
27+ # this just copies the django projext into the working dir.
28+ COPY . .
29+
30+ ENTRYPOINT [ "/usr/src/META/Registrering/entrypoint.sh" ]
31+
Original file line number Diff line number Diff line change 1+ #! /bin/sh
2+
3+ if [ " $DATABASE " = " postgres" ]
4+ then
5+ echo " Waiting for postgres..."
6+ while ! nc -z $SQL_HOST $SQL_PORT ; do
7+ sleep 0.1
8+ done
9+
10+ echo " PostgreSQL is running chief!"
11+ fi
12+
13+ python manage.py migrate
14+
15+ exec " $@ "
16+
You can’t perform that action at this time.
0 commit comments