From bfe9d27d718220b72a615bec5b3cb97606712291 Mon Sep 17 00:00:00 2001 From: Dariusz Niemczyk Date: Tue, 11 Jul 2023 23:29:54 +0200 Subject: [PATCH] Make dockerable for hscloud --- .dockerignore | 4 ++++ Dockerfile | 15 +++++++++++---- 2 files changed, 15 insertions(+), 4 deletions(-) diff --git a/.dockerignore b/.dockerignore index 782f5ef..20cfd98 100644 --- a/.dockerignore +++ b/.dockerignore @@ -11,3 +11,7 @@ postgres-hstore/ docker-compose.yml docker-compose.override.yml build_static +.venv +.vscode +.history +log diff --git a/Dockerfile b/Dockerfile index 7bc1528..f0e38a9 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,11 +1,18 @@ -FROM python:3.5.9@sha256:3a71fd2dac2343263993f4ab898c9398dfbfd0235dafe41e784876b69bdfa899 +FROM python:3.11.4-slim-bookworm ENV PYTHONUNBUFFERED 1 RUN mkdir /code WORKDIR /code +RUN apt-get update && apt-get install -y --no-install-recommends \ +libpq-dev \ +gcc \ + && \ +apt-get clean && \ +rm -rf /var/lib/apt/lists/* ADD requirements.txt /code/ RUN pip install --no-cache-dir -r requirements.txt -RUN wget https://github.com/vishnubob/wait-for-it/raw/8ed92e8cab83cfed76ff012ed4a36cef74b28096/wait-for-it.sh -O /usr/local/bin/wait-for-it && chmod +x /usr/local/bin/wait-for-it ADD . /code/ -RUN python manage.py collectstatic -CMD bash -c "python manage.py migrate && python manage.py runserver 0.0.0.0:8000" +RUN python -m pip install gunicorn + +RUN python manage.py collectstatic +CMD bash -c "python manage.py migrate && gunicorn -b 0.0.0.0:8001 spejstore.wsgi:application"