Basic docker functionnality
This commit is contained in:
parent
2910db9742
commit
c874b44896
17
Dockerfile
Normal file
17
Dockerfile
Normal file
|
@ -0,0 +1,17 @@
|
|||
FROM python:3.11-slim-buster
|
||||
|
||||
WORKDIR /opt
|
||||
|
||||
ENV PYTHONDONTWRITEBYTECODE 1
|
||||
ENV PYTHONUNBUFFERED 1
|
||||
|
||||
RUN apt update && apt install -y libpq-dev build-essential netcat && rm -rf /var/lib/apt/lists/*
|
||||
|
||||
COPY ./requirements.txt .
|
||||
|
||||
RUN pip install --upgrade pip && pip install -r requirements.txt
|
||||
|
||||
COPY . .
|
||||
|
||||
ENTRYPOINT ["./entrypoint.sh"]
|
||||
CMD ["gunicorn", "tldtest.wsgi:application", "--bind", "0.0.0.0:8000"]
|
18
docker-compose.yml
Normal file
18
docker-compose.yml
Normal file
|
@ -0,0 +1,18 @@
|
|||
version: '3.11'
|
||||
|
||||
services:
|
||||
web:
|
||||
build:
|
||||
context: .
|
||||
dockerfile: Dockerfile
|
||||
command: gunicorn tldtest.wsgi:application --bind 0.0.0.0:8000
|
||||
ports:
|
||||
- 8000:8000
|
||||
depends_on:
|
||||
- db
|
||||
db:
|
||||
image: postgres:15
|
||||
volumes:
|
||||
- postgres_data:/var/lib/postgresql/data/
|
||||
volumes:
|
||||
postgres_data:
|
19
entrypoint.sh
Executable file
19
entrypoint.sh
Executable file
|
@ -0,0 +1,19 @@
|
|||
#!/bin/sh
|
||||
|
||||
if [ "$DATABASE" = "postgres" ]
|
||||
then
|
||||
echo "Waiting for postgres..."
|
||||
|
||||
while ! nc -z $SQL_HOST $SQL_PORT; do
|
||||
sleep 0.1
|
||||
done
|
||||
|
||||
echo "PostgreSQL started"
|
||||
fi
|
||||
|
||||
python manage.py makemigrations # Make migrations
|
||||
python manage.py migrate # Apply database migrations
|
||||
python manage.py collectstatic
|
||||
|
||||
|
||||
exec "$@"
|
|
@ -3,13 +3,18 @@ build==1.0.3
|
|||
click==8.1.7
|
||||
Django==5.0.2
|
||||
django-admin-extra-buttons==1.5.7
|
||||
django-appconf==1.0.6
|
||||
django-compressor==4.4
|
||||
flake8==7.0.0
|
||||
gunicorn==21.2.0
|
||||
mccabe==0.7.0
|
||||
packaging==23.2
|
||||
pip-tools==7.3.0
|
||||
pycodestyle==2.11.1
|
||||
pyflakes==3.2.0
|
||||
pyproject_hooks==1.0.0
|
||||
rcssmin==1.1.1
|
||||
rjsmin==1.2.1
|
||||
sqlparse==0.4.4
|
||||
|
||||
tomli==2.0.1
|
||||
typing_extensions==4.10.0
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
#
|
||||
# This file is autogenerated by pip-compile with Python 3.10
|
||||
# This file is autogenerated by pip-compile with Python 3.12
|
||||
# by the following command:
|
||||
#
|
||||
# pip-compile --output-file=requirements.txt requirements.in
|
||||
|
@ -23,11 +23,15 @@ django==5.0.2
|
|||
django-admin-extra-buttons==1.5.7
|
||||
# via -r requirements.in
|
||||
django-appconf==1.0.6
|
||||
# via django-compressor
|
||||
# via
|
||||
# -r requirements.in
|
||||
# django-compressor
|
||||
django-compressor==4.4
|
||||
# via -r requirements.in
|
||||
flake8==7.0.0
|
||||
# via -r requirements.in
|
||||
gunicorn==21.2.0
|
||||
# via -r requirements.in
|
||||
mccabe==0.7.0
|
||||
# via
|
||||
# -r requirements.in
|
||||
|
@ -36,6 +40,7 @@ packaging==23.2
|
|||
# via
|
||||
# -r requirements.in
|
||||
# build
|
||||
# gunicorn
|
||||
pip-tools==7.3.0
|
||||
# via -r requirements.in
|
||||
pycodestyle==2.11.1
|
||||
|
@ -51,20 +56,21 @@ pyproject-hooks==1.0.0
|
|||
# -r requirements.in
|
||||
# build
|
||||
rcssmin==1.1.1
|
||||
# via django-compressor
|
||||
# via
|
||||
# -r requirements.in
|
||||
# django-compressor
|
||||
rjsmin==1.2.1
|
||||
# via django-compressor
|
||||
# via
|
||||
# -r requirements.in
|
||||
# django-compressor
|
||||
sqlparse==0.4.4
|
||||
# via
|
||||
# -r requirements.in
|
||||
# django
|
||||
tomli==2.0.1
|
||||
# via
|
||||
# build
|
||||
# pip-tools
|
||||
# pyproject-hooks
|
||||
# via -r requirements.in
|
||||
typing-extensions==4.10.0
|
||||
# via asgiref
|
||||
# via -r requirements.in
|
||||
wheel==0.42.0
|
||||
# via pip-tools
|
||||
|
||||
|
|
Loading…
Reference in a new issue