Skip to content

Commit

Permalink
Updated docker configs to work with poetry
Browse files Browse the repository at this point in the history
  • Loading branch information
Andrey Rusakov committed Aug 14, 2024
1 parent 1c3ecee commit 43a4394
Show file tree
Hide file tree
Showing 4 changed files with 33 additions and 25 deletions.
28 changes: 11 additions & 17 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,20 +1,14 @@
FROM ghcr.io/osgeo/gdal:ubuntu-small-3.5.2
FROM ubuntu:oracular AS builder
LABEL Maintainer="[email protected]" 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
13 changes: 7 additions & 6 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand All @@ -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

Expand Down
14 changes: 13 additions & 1 deletion poetry.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
name = "geoshop-back"
version = "0.1.0"
description = "Backend for the geoshop service"
authors = ["Your Name <you@example.com>"]
authors = ["Andrey Rusakov <andrey.rusakov@camptocamp.com>"]
license = "BSD 3-Clause License"

[tool.poetry.dependencies]
Expand Down Expand Up @@ -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"]
Expand Down

0 comments on commit 43a4394

Please sign in to comment.