From 78575075e56d4c4fdfa94a86daec1bc853313d7b Mon Sep 17 00:00:00 2001 From: Aarni Halinen Date: Mon, 29 Mar 2021 21:40:38 +0300 Subject: [PATCH] update Dockerfile to use poetry --- Dockerfile | 27 ++++++++++++++++----------- docker-compose.yml | 1 - 2 files changed, 16 insertions(+), 12 deletions(-) diff --git a/Dockerfile b/Dockerfile index a82b6ad..458ecdd 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,19 +1,24 @@ -FROM python:3.7-alpine +FROM python:3.9-alpine ENV PYTHONUNBUFFERED 1 WORKDIR /app -COPY requirements.txt ./ -COPY requirements.production.txt ./ COPY . ./ -# uWSGI, gunicorn etc. -RUN apk add --no-cache python3-dev build-base linux-headers pcre-dev openssl bash \ +ENV POETRY_VERSION=1.1.4 + +# Rust and shit https://cryptography.io/en/latest/installation.html +RUN apk --no-cache --update --upgrade add gcc musl-dev python3-dev libffi-dev openssl-dev cargo \ + # Pillow and maybe some unnneeded? + jpeg-dev zlib-dev build-base linux-headers pcre-dev bash \ # PSQL - && apk add --no-cache postgresql-dev \ - # Pillow - && apk add --no-cache jpeg-dev zlib-dev \ - && pip install --upgrade pip \ - && pip install -r requirements.txt \ - && pip install -r requirements.production.txt + && apk add --no-cache postgresql-dev + +# System deps: +RUN pip install -U pip +RUN pip install "poetry==$POETRY_VERSION" + +# Project initialization: +RUN poetry config virtualenvs.create false \ + && poetry install --no-dev --no-interaction --no-ansi RUN python manage.py collectstatic --noinput diff --git a/docker-compose.yml b/docker-compose.yml index 41393bf..8daaed6 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -13,7 +13,6 @@ services: web: build: . image: registry.gitlab.com/sahkoinsinoorikilta/vtmk/web2.0-backend - command: ["bash", "-c", "cd /app & bash setup.sh --no-input --no-npm && gunicorn -w 4 -b 0.0.0.0:8000 sikweb.wsgi"] env_file: - .env ports: