From a63fb287fd5ce9ffa6a6b1ed1ace3786c4e4c204 Mon Sep 17 00:00:00 2001 From: flifloo Date: Fri, 3 Dec 2021 01:45:44 +0100 Subject: [PATCH] Add docker image and compose --- Dockerfile | 9 +++++++++ docker-compose.yml | 25 +++++++++++++++++++++++++ 2 files changed, 34 insertions(+) create mode 100644 Dockerfile create mode 100644 docker-compose.yml diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..5da2f83 --- /dev/null +++ b/Dockerfile @@ -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"] diff --git a/docker-compose.yml b/docker-compose.yml new file mode 100644 index 0000000..39a6e11 --- /dev/null +++ b/docker-compose.yml @@ -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: