Skip to content

Commit

Permalink
move docker image and update dependencies to works with python 3.12
Browse files Browse the repository at this point in the history
  • Loading branch information
submarcos committed Nov 25, 2024
1 parent 289c1a8 commit d67f9ae
Show file tree
Hide file tree
Showing 4 changed files with 132 additions and 138 deletions.
34 changes: 17 additions & 17 deletions .docker/backend/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
FROM ubuntu:jammy as base

ENV PYTHONBUFFERED 1
ENV DEBIAN_FRONTEND noninteractive
ENV LANG C.UTF-8
ENV TZ UTC
ENV POSTGRES_HOST db
ENV POSTGRES_PORT 5432
FROM ubuntu:noble AS base

ENV PYTHONBUFFERED=1
ENV DEBIAN_FRONTEND=noninteractive
ENV LANG=C.UTF-8
ENV TZ=UTC
ENV POSTGRES_HOST=db
ENV POSTGRES_PORT=5432
ENV CUSTOM_SETTINGS_FILE="/opt/terra-visu/var/conf/custom.py"

RUN apt-get -y -qq update \
Expand All @@ -19,12 +19,12 @@ RUN apt-get -y -qq update \
gettext \
postgresql-client \
tzdata \
netcat \
netcat-traditional \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/* \
&& rm -rf /var/cache/apt/archives/*

RUN adduser docker --disabled-password
RUN useradd --system docker
RUN mkdir -p /opt/terra-visu && chown docker:docker /opt
WORKDIR /opt/terra-visu

Expand All @@ -33,7 +33,7 @@ COPY .docker/backend/entrypoint.sh /usr/local/bin/entrypoint.sh
ENTRYPOINT ["/usr/local/bin/entrypoint.sh"]
EXPOSE 8000

FROM base as build
FROM base AS build

RUN apt-get -y -qq update \
&& apt-get -y -qq install \
Expand All @@ -48,23 +48,23 @@ RUN apt-get -y -qq update \

USER docker

RUN python3 -m venv /opt/venv && /opt/venv/bin/pip install --no-cache-dir --upgrade pip wheel
RUN python3 -m venv /opt/venv && /opt/venv/bin/pip install --no-cache-dir --upgrade pip<=24.3 wheel

COPY requirements.txt /opt/terra-visu/requirements.txt
RUN /opt/venv/bin/pip install --no-cache-dir --upgrade -r /opt/terra-visu/requirements.txt

FROM build as dev
FROM build AS dev

COPY dev-requirements.txt /opt/terra-visu/dev-requirements.txt
RUN /opt/venv/bin/pip install --no-cache-dir --upgrade -r /opt/terra-visu/dev-requirements.txt
COPY .docker/backend/update.sh /usr/local/bin/update.sh

CMD /opt/venv/bin/python manage.py runserver 0.0.0.0:8000
CMD ["/opt/venv/bin/python", "manage.py", "runserver", "0.0.0.0:8000"]

FROM base as prod
FROM base AS prod

ENV GUNICORN_WORKERS 1
ENV GUNICORN_TIMEOUT 60
ENV GUNICORN_WORKERS=1
ENV GUNICORN_TIMEOUT=60

COPY --from=build /opt/venv /opt/venv

Expand Down
105 changes: 48 additions & 57 deletions dev-requirements.txt
Original file line number Diff line number Diff line change
@@ -1,20 +1,20 @@
#
# This file is autogenerated by pip-compile with Python 3.10
# This file is autogenerated by pip-compile with Python 3.12
# by the following command:
#
# pip-compile --strip-extras dev-requirements.in
# pip-compile dev-requirements.in
#
alabaster==0.7.16
# via
# -r docs/requirements.txt
# -r /opt/terra-visu/docs/requirements.txt
# sphinx
asgiref==3.6.0
asgiref==3.8.1
# via
# -c requirements.txt
# -c /opt/terra-visu/requirements.txt
# django
babel==2.15.0
# via
# -r docs/requirements.txt
# -r /opt/terra-visu/docs/requirements.txt
# sphinx
black==24.10.0
# via -r dev-requirements.in
Expand All @@ -24,19 +24,19 @@ bpython==0.24
# via -r dev-requirements.in
build==1.2.1
# via pip-tools
certifi==2024.7.4
certifi==2024.8.30
# via
# -c requirements.txt
# -r docs/requirements.txt
# -c /opt/terra-visu/requirements.txt
# -r /opt/terra-visu/docs/requirements.txt
# requests
charset-normalizer==3.1.0
charset-normalizer==3.4.0
# via
# -c requirements.txt
# -r docs/requirements.txt
# -c /opt/terra-visu/requirements.txt
# -r /opt/terra-visu/docs/requirements.txt
# requests
click==8.1.3
click==8.1.7
# via
# -c requirements.txt
# -c /opt/terra-visu/requirements.txt
# black
# pip-tools
coverage==7.6.7
Expand All @@ -49,13 +49,13 @@ cwcwidth==0.1.9
# curtsies
django==4.2.16
# via
# -c requirements.txt
# -c /opt/terra-visu/requirements.txt
# django-debug-toolbar
django-debug-toolbar==4.4.6
# via -r dev-requirements.in
docutils==0.20.1
# via
# -r docs/requirements.txt
# -r /opt/terra-visu/docs/requirements.txt
# sphinx
# sphinx-rtd-theme
factory-boy==3.3.1
Expand All @@ -68,33 +68,33 @@ freezegun==1.5.1
# via -r dev-requirements.in
greenlet==3.0.3
# via bpython
idna==3.7
idna==3.10
# via
# -c requirements.txt
# -r docs/requirements.txt
# -c /opt/terra-visu/requirements.txt
# -r /opt/terra-visu/docs/requirements.txt
# requests
imagesize==1.4.1
# via
# -r docs/requirements.txt
# -r /opt/terra-visu/docs/requirements.txt
# sphinx
isort==5.13.2
# via -r dev-requirements.in
jinja2==3.1.4
# via
# -r docs/requirements.txt
# -r /opt/terra-visu/docs/requirements.txt
# sphinx
markupsafe==2.1.5
# via
# -r docs/requirements.txt
# -r /opt/terra-visu/docs/requirements.txt
# jinja2
mccabe==0.7.0
# via flake8
mypy-extensions==1.0.0
# via black
packaging==23.1
packaging==24.2
# via
# -c requirements.txt
# -r docs/requirements.txt
# -c /opt/terra-visu/requirements.txt
# -r /opt/terra-visu/docs/requirements.txt
# black
# build
# sphinx
Expand All @@ -110,92 +110,83 @@ pyflakes==3.2.0
# via flake8
pygments==2.18.0
# via
# -r docs/requirements.txt
# -r /opt/terra-visu/docs/requirements.txt
# bpython
# sphinx
pyproject-hooks==1.1.0
# via
# build
# pip-tools
python-dateutil==2.8.2
python-dateutil==2.9.0.post0
# via
# -c requirements.txt
# -c /opt/terra-visu/requirements.txt
# faker
# freezegun
pyxdg==0.28
# via bpython
requests==2.32.3
# via
# -c requirements.txt
# -r docs/requirements.txt
# -c /opt/terra-visu/requirements.txt
# -r /opt/terra-visu/docs/requirements.txt
# bpython
# sphinx
six==1.16.0
# via
# -c requirements.txt
# -c /opt/terra-visu/requirements.txt
# blessed
# python-dateutil
snowballstemmer==2.2.0
# via
# -r docs/requirements.txt
# -r /opt/terra-visu/docs/requirements.txt
# sphinx
sphinx==7.3.7
# via
# -r docs/requirements.txt
# -r /opt/terra-visu/docs/requirements.txt
# sphinx-rtd-theme
# sphinxcontrib-jquery
sphinx-rtd-theme==3.0.2
# via -r docs/requirements.txt
# via -r /opt/terra-visu/docs/requirements.txt
sphinxcontrib-applehelp==1.0.8
# via
# -r docs/requirements.txt
# -r /opt/terra-visu/docs/requirements.txt
# sphinx
sphinxcontrib-devhelp==1.0.6
# via
# -r docs/requirements.txt
# -r /opt/terra-visu/docs/requirements.txt
# sphinx
sphinxcontrib-htmlhelp==2.0.5
# via
# -r docs/requirements.txt
# -r /opt/terra-visu/docs/requirements.txt
# sphinx
sphinxcontrib-jquery==4.1
# via
# -r docs/requirements.txt
# -r /opt/terra-visu/docs/requirements.txt
# sphinx-rtd-theme
sphinxcontrib-jsmath==1.0.1
# via
# -r docs/requirements.txt
# -r /opt/terra-visu/docs/requirements.txt
# sphinx
sphinxcontrib-qthelp==1.0.7
# via
# -r docs/requirements.txt
# -r /opt/terra-visu/docs/requirements.txt
# sphinx
sphinxcontrib-serializinghtml==1.1.10
# via
# -r docs/requirements.txt
# -r /opt/terra-visu/docs/requirements.txt
# sphinx
sqlparse==0.4.4
sqlparse==0.5.2
# via
# -c requirements.txt
# -c /opt/terra-visu/requirements.txt
# django
# django-debug-toolbar
tomli==2.0.1
urllib3==2.2.3
# via
# -r docs/requirements.txt
# black
# build
# pip-tools
# sphinx
typing-extensions==4.12.2
# via black
urllib3==1.26.19
# via
# -c requirements.txt
# -r docs/requirements.txt
# -c /opt/terra-visu/requirements.txt
# -r /opt/terra-visu/docs/requirements.txt
# requests
wcwidth==0.2.6
wcwidth==0.2.13
# via
# -c requirements.txt
# -c /opt/terra-visu/requirements.txt
# blessed
wheel==0.43.0
# via pip-tools
Expand Down
28 changes: 13 additions & 15 deletions docs/requirements.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#
# This file is autogenerated by pip-compile with Python 3.10
# This file is autogenerated by pip-compile with Python 3.12
# by the following command:
#
# pip-compile --strip-extras
Expand All @@ -8,37 +8,37 @@ alabaster==0.7.16
# via sphinx
babel==2.15.0
# via sphinx
certifi==2024.7.4
certifi==2024.8.30
# via
# -c docs/../requirements.txt
# -c /opt/terra-visu/requirements.txt
# requests
charset-normalizer==3.1.0
charset-normalizer==3.4.0
# via
# -c docs/../requirements.txt
# -c /opt/terra-visu/requirements.txt
# requests
docutils==0.20.1
# via
# sphinx
# sphinx-rtd-theme
idna==3.7
idna==3.10
# via
# -c docs/../requirements.txt
# -c /opt/terra-visu/requirements.txt
# requests
imagesize==1.4.1
# via sphinx
jinja2==3.1.4
# via sphinx
markupsafe==2.1.5
# via jinja2
packaging==23.1
packaging==24.2
# via
# -c docs/../requirements.txt
# -c /opt/terra-visu/requirements.txt
# sphinx
pygments==2.18.0
# via sphinx
requests==2.32.3
# via
# -c docs/../requirements.txt
# -c /opt/terra-visu/requirements.txt
# sphinx
snowballstemmer==2.2.0
# via sphinx
Expand All @@ -47,7 +47,7 @@ sphinx==7.3.7
# sphinx-rtd-theme
# sphinxcontrib-jquery
sphinx-rtd-theme==3.0.2
# via -r docs/requirements.in
# via -r requirements.in
sphinxcontrib-applehelp==1.0.8
# via sphinx
sphinxcontrib-devhelp==1.0.6
Expand All @@ -62,9 +62,7 @@ sphinxcontrib-qthelp==1.0.7
# via sphinx
sphinxcontrib-serializinghtml==1.1.10
# via sphinx
tomli==2.0.1
# via sphinx
urllib3==1.26.19
urllib3==2.2.3
# via
# -c docs/../requirements.txt
# -c /opt/terra-visu/requirements.txt
# requests
Loading

0 comments on commit d67f9ae

Please sign in to comment.