diff --git a/Dockerfile b/Dockerfile index 7897bfd3..4a32c3bd 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,20 +1,14 @@ -FROM ghcr.io/osgeo/gdal:ubuntu-small-3.5.2 +FROM ubuntu:oracular AS builder +LABEL Maintainer="andrey.rusakov@camptocamp.com" Vendor="Camptocamp" -RUN apt-get update --fix-missing && \ - apt-get install gettext python3-pip libcairo2-dev build-essential python3-dev \ - pipenv python3-setuptools python3-wheel python3-cffi libcairo2 libpango-1.0-0 \ - libpangocairo-1.0-0 libgdk-pixbuf2.0-0 libffi-dev shared-mime-info libpq-dev -y && \ - apt-get clean && \ - rm -rf /var/lib/apt/lists/* - -COPY ./requirements.txt /app/geoshop_back/requirements.txt WORKDIR /app/geoshop_back/ -RUN pip3 install -r requirements.txt - -# Update C env vars so compiler can find gdal -ENV CPLUS_INCLUDE_PATH=/usr/include/gdal -ENV C_INCLUDE_PATH=/usr/include/gdal -ENV PYTHONUNBUFFERED 1 - COPY . /app/geoshop_back/ -RUN mv /app/geoshop_back/default_settings.py /app/geoshop_back/settings.py + +RUN apt update && \ + apt upgrade -y && \ + apt install -y bash postgresql curl \ + python3 python3-poetry python3-setuptools gunicorn \ + libgdal-dev libffi-dev && \ + cd /app/geoshop_back/ && \ + poetry update && \ + poetry install --no-root diff --git a/docker-compose.yml b/docker-compose.yml index 236cbdde..b15b095f 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -39,10 +39,11 @@ services: env_file: .env environment: PGHOST: "db" - command: - - bash - - -c - - "python manage.py migrate && python manage.py collectstatic --noinput && python manage.py compilemessages --locale=fr && python manage.py fixturize" + command: > + poetry run python3 manage.py migrate && + poetry run python3 manage.py collectstatic --noinput && + poetry run python3 manage.py compilemessages --locale=fr && + poetry run python3 manage.py fixturize volumes: - "static-files:/app/geoshop_back/static:rw" networks: @@ -58,12 +59,12 @@ services: env_file: .env environment: PGHOST: "db" - command: "gunicorn wsgi -b :8000 --timeout 90" + command: "poetry run gunicorn wsgi -b :8000 --timeout 90" restart: unless-stopped volumes: - "static-files:/app/geoshop_back/static:ro" ports: - - "8080:8000" + - "8000:8000" networks: - geoshop diff --git a/poetry.lock b/poetry.lock index 6a0b5128..5aa7644d 100644 --- a/poetry.lock +++ b/poetry.lock @@ -247,6 +247,17 @@ uritemplate = ">=2.0.0" offline = ["drf-spectacular-sidecar"] sidecar = ["drf-spectacular-sidecar"] +[[package]] +name = "gdal" +version = "3.4.1" +description = "GDAL: Geospatial Data Abstraction Library" +category = "main" +optional = false +python-versions = ">=3.6.0" + +[package.extras] +numpy = ["numpy (>1.0.0)"] + [[package]] name = "gunicorn" version = "23.0.0" @@ -556,7 +567,7 @@ brotli = ["brotli"] [metadata] lock-version = "1.1" python-versions = "^3.10" -content-hash = "d40f265cf78f88a1020b6e6d72e38a5d54f4bd998cf148426bb9b97f20334ec4" +content-hash = "f3584eb0e4027d97596bbc423a93d522ccca5af8b80816953b66b176ed4f4b72" [metadata.files] asgiref = [] @@ -577,6 +588,7 @@ djangorestframework = [] djangorestframework-gis = [] djangorestframework-simplejwt = [] drf-spectacular = [] +gdal = [] gunicorn = [] idna = [] inflection = [] diff --git a/pyproject.toml b/pyproject.toml index ed59eb5a..e8e5daaf 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -2,7 +2,7 @@ name = "geoshop-back" version = "0.1.0" description = "Backend for the geoshop service" -authors = ["Your Name "] +authors = ["Andrey Rusakov "] license = "BSD 3-Clause License" [tool.poetry.dependencies] @@ -51,6 +51,7 @@ uritemplate = "^4.1.1" urllib3 = "^2.2.2" whitenoise = "^6.7.0" Django = "^5.1" +GDAL = "3.4.1" [build-system] requires = ["poetry-core>=1.0.0"]