Add docker image and compose

This commit is contained in:
Ethanell 2021-12-03 01:45:44 +01:00
parent 232b976f2d
commit a63fb287fd
2 changed files with 34 additions and 0 deletions

9
Dockerfile Normal file
View file

@ -0,0 +1,9 @@
FROM python:3.9.9-alpine
WORKDIR /nuitdelinfo_2021
COPY . .
RUN apk add --no-cache postgresql-libs && \
apk add --no-cache --virtual .build-deps gcc musl-dev postgresql-dev && \
pip install --no-cache-dir -r requirements.txt && \
apk --purge del .build-deps
RUN cp /nuitdelinfo_2021/nuitdelinfo_2021/settings.py.exemple /nuitdelinfo_2021/nuitdelinfo_2021/settings.py
CMD [ "python", "./manage.py", "runserver", "0.0.0.0:8000"]

25
docker-compose.yml Normal file
View file

@ -0,0 +1,25 @@
version: "3"
services:
django:
container_name: "nuitdelinfo_2021"
build: ./
image: nuitdelinfo_2021
ports:
- "8001:8000"
volumes:
- "django:/nuitdelinfo_2021/"
postgres:
container_name: "nuitdelinfo_2021_db"
image: postgres
environment:
POSTGRES_PASSWORD: nuitdelinfo_2021
POSTGRES_USER: nuitdelinfo_2021
POSTGRES_DB: nuitdelinfo_2021
volumes:
- "db:/var/lib/postgresql/data"
volumes:
django:
db: