Browse Source

Python environment is now entirely built in Docker.

Use of psycopg2 instead of psycopg2-bin because the binary version is not recommended.
development-ci
Franco Masotti 11 months ago
parent
commit
97a1663eeb
Signed by: frnmst
GPG Key ID: 24116ED85666780A
  1. 5
      .dockerignore
  2. 10
      Dockerfile
  3. 1
      MANIFEST.in
  4. 20
      Pipfile
  5. 2
      docker-compose.yml.dist
  6. 7
      docs/install.rst
  7. 2
      setup.py

5
.dockerignore

@ -0,0 +1,5 @@
db
__pycache__
docker/
README.rst
Pipfile.lock

10
Dockerfile

@ -32,10 +32,16 @@ ARG GID
# Unbuffered output.
ENV PYTHONUNBUFFERED 1
COPY --chown=django:django ./requirements.txt /code/django/
COPY --chown=django:django ./Pipfile /code/django/
# Executable path for python binaries.
ENV PATH "$PATH:/code/.local/bin"
RUN pip3 install --user --no-cache-dir --requirement /code/django/requirements.txt && rm /code/django/requirements.txt
WORKDIR /code/django
RUN pipenv lock --requirements > requirements.txt \
&& pip3 install --user --no-cache-dir --requirement requirements.txt \
&& rm requirements.txt
WORKDIR /
USER root
COPY --chown=django:django ./Makefile ./manage.py ./SECRET_SETTINGS.py ./.env ./uwsgi.ini /code/django/

1
MANIFEST.in

@ -7,4 +7,5 @@ recursive-include django_futils/templates *
recursive-include django_futils/static *
recursive-include django_futils/locale *
prune django_futils/migrations
exclude .dockerignore
include *.dist

20
Pipfile

@ -24,19 +24,22 @@ url = "https://pypi.org/simple"
verify_ssl = true
[dev-packages]
# Tests.
model-bakery = "~=1.3"
pre-commit = "~=2.14"
[packages]
# Documentation.
Sphinx = "~=4.2"
sphinx-rtd-theme = "~=1.0"
# Tools.
pygraphviz = "~=1.7"
pre-commit = "~=2.14"
[packages]
# Base.
# Tests.
model-bakery = "~=1.3"
########
# Base #
########
Django = "~=3.2"
uwsgi = "~=2.0"
requests = "~=2.26"
@ -49,12 +52,13 @@ django-vies = "~=6.0"
django-simple-history = "~=3.0"
## Remove dangling files.
django-cleanup = "~=5.2"
django-import-export = "~=2.5"
django-import-export = "~=2.6"
# Postgres.
# If you prefer to avoid building psycopg2 from source, please install the PyPI
#'psycopg2-binary' package instead.
psycopg2-binary = "~=2.9"
# 'psycopg2-bin' package instead.
# See https://www.psycopg.org/docs/install.html#psycopg-vs-psycopg-binary
psycopg2 = "~=2.9"
# Tools.
django-extensions = "~=3.1"

2
docker-compose.yml.dist

@ -28,7 +28,7 @@ services:
dependencies:
image: docker_debian_postgis_django
build:
context: https://software.franco.net.eu.org/frnmst/docker-debian-postgis-django.git#6.0.0
context: https://software.franco.net.eu.org/frnmst/docker-debian-postgis-django.git#6.0.1
redis:
image: redis:6.2.5

7
docs/install.rst

@ -51,8 +51,6 @@ Install these packages from your package manager:
+----------------------+---------------------+------------------+
| Python | - python3 | 3.8 |
+----------------------+---------------------+------------------+
| Graphviz | | 2.44.1 |
+----------------------+---------------------+------------------+
Install these packages from PyPI:
@ -61,8 +59,6 @@ Install these packages from PyPI:
+======================+=====================+==================+
| docker-compose | - docker-compose | >= 1.25.5 |
+----------------------+---------------------+------------------+
| graphviz | | |
+----------------------+---------------------+------------------+
| pipenv | - pipenv | |
+----------------------+---------------------+------------------+
@ -76,8 +72,7 @@ building the documentation on Debian GNU/Linux:
::
# apt-get install libgdal-dev libgraphviz-dev graphviz
$ pip3 install --user pipenv docker-compose graphviz
$ pip3 install --user pipenv docker-compose
$ make install-dev

2
setup.py

@ -56,7 +56,7 @@ setup(
'django-simple-history>=3.0,<3.1',
'django-cleanup>=5.2,<5.3',
'django-import-export>=2.5,<2.6',
'psycopg2-binary>=2.9,<2.10',
'psycopg2>=2.9,<2.10',
'django-extensions>=3.1,<3.2',
'django-leaflet>=0.28,<0.29',
'django-htmlmin>=0.11,<0.12',

Loading…
Cancel
Save