Actualizar arches/Dockerfile

This commit is contained in:
2026-04-20 11:58:15 -04:00
parent ceb432d359
commit 0e175f9853

View File

@@ -3,37 +3,56 @@ FROM ubuntu:22.04
USER root USER root
# Do the apt installation also install git # Set environment variables to make installations non-interactive
RUN apt-get update && && apt-get install -y --no-install-recommends \ ENV DEBIAN_FRONTEND=noninteractive
ENV TZ="America/La_Paz"
# Update package lists and install basic packages first
RUN apt-get update && apt-get install -y --no-install-recommends \
curl \
wget \
gnupg \
lsb-release \
software-properties-common \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/*
# Add Python 3.12 repository and install Python packages
RUN add-apt-repository ppa:deadsnakes/ppa \
&& apt-get update \
&& apt-get install -y --no-install-recommends \
python3.12 \ python3.12 \
python3.12-dev \ python3.12-dev \
python3.12-venv \ python3.12-venv \
python3-pip \ python3-pip \
make software-properties-common \ && apt-get clean \
curl \ && rm -rf /var/lib/apt/lists/*
# Install system dependencies
RUN apt-get update \
&& apt-get install -y --no-install-recommends \
make \
gcc \ gcc \
build-essential \ build-essential \
mime-support \ mime-support \
libgdal-dev \ libgdal-dev \
dos2unix \ dos2unix \
nano nano \
RUN apt-get update --fix-missing && apt-get install -y git git \
postgresql-client-14 \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/*
# Install the postgres client
RUN apt-get update
RUN apt-get install -y postgresql-client-14
FROM python:3.12
# set environment variables # set environment variables
ENV PYTHONDONTWRITEBYTECODE 1 ENV PYTHONDONTWRITEBYTECODE 1
ENV PYTHONUNBUFFERED 1 ENV PYTHONUNBUFFERED 1
# Set up a virual environment to use for all later commands. # Set up a virual environment to use for all later commands.
ENV VIRTUAL_ENV=/opt/venv RUN python3.12 -m venv /opt/venv \
RUN python3 -m venv $VIRTUAL_ENV && . /opt/venv/bin/activate \
ENV PATH="$VIRTUAL_ENV/bin:$PATH" && pip install --upgrade pip
RUN pip install --upgrade pip # Make sure we use the virtualenv:
ENV PATH="/opt/venv/bin:$PATH"
## Setting default environment variables ## Setting default environment variables
ARG ARCHES_ROOT ARG ARCHES_ROOT
@@ -42,13 +61,19 @@ ARG ARCHES_PROJECT
# Project specific paths # Project specific paths
ARG APP_ROOT ARG APP_ROOT
ARG APP_COMP_FOLDER ARG APP_COMP_FOLDER
ARG UPLOADED_FILES_FOLDER
ARG ARCHES_PIP_VERSION
# settings_local.py provides the DB credentials, etc. to the Arches project. # settings_local.py provides the DB credentials, etc. to the Arches project.
ENV SETTINGS_PATH=${APP_COMP_FOLDER}/settings.py
ENV SETTINGS_LOCAL_PATH=${APP_COMP_FOLDER}/settings_local.py ENV SETTINGS_LOCAL_PATH=${APP_COMP_FOLDER}/settings_local.py
ENV CELERY_PATH=${APP_COMP_FOLDER}/celery.py ENV CELERY_PATH=${APP_COMP_FOLDER}/celery.py
ENV URLS_PATH=${APP_COMP_FOLDER}/urls.py ENV URLS_PATH=${APP_COMP_FOLDER}/urls.py
ENV GUNICORN_CONFIG_PATH=${APP_COMP_FOLDER}/gunicorn_config.py ENV GUNICORN_CONFIG_PATH=${APP_COMP_FOLDER}/gunicorn_config.py
ENV ARCHES_DATA=${ARCHES_ROOT}/arches_data ENV ARCHES_DATA=${ARCHES_ROOT}/arches_data
ENV PACKAGE_PATH=${APP_COMP_FOLDER}/package.json ENV PACKAGE_PATH=${APP_COMP_FOLDER}/package.json
ENV ESLINT_CONFIG_MJS_PATH_USE=${APP_ROOT}/eslint.config.mjs
ENV UPLOADED_FILES_FOLDER=${UPLOADED_FILES_FOLDER}
ENV WHEELS=/wheels ENV WHEELS=/wheels
ENV PYTHONUNBUFFERED=1 ENV PYTHONUNBUFFERED=1
ENV PYTHONDONTWRITEBYTECODE 1 ENV PYTHONDONTWRITEBYTECODE 1
@@ -79,16 +104,16 @@ RUN set -ex \
python3-dev \ python3-dev \
postgresql-client-14 \ postgresql-client-14 \
dos2unix \ dos2unix \
gettext \ wait-for-it \
nano \
" \ " \
&& apt-get install -y --no-install-recommends curl \
&& curl -sL https://deb.nodesource.com/setup_16.x | bash - \ && curl -sL https://deb.nodesource.com/setup_16.x | bash - \
&& curl -sL https://www.postgresql.org/media/keys/ACCC4CF8.asc | apt-key add - \ && curl -sL https://www.postgresql.org/media/keys/ACCC4CF8.asc | gpg --dearmor -o /usr/share/keyrings/postgresql-keyring.gpg \
&& add-apt-repository "deb http://apt.postgresql.org/pub/repos/apt/ $(lsb_release -sc)-pgdg main" \ && echo "deb [signed-by=/usr/share/keyrings/postgresql-keyring.gpg] http://apt.postgresql.org/pub/repos/apt/ $(lsb_release -cs)-pgdg main" | tee /etc/apt/sources.list.d/postgresql.list \
&& apt-get update -y \ && apt-get update -y \
&& apt-get install -y "wait-for-it" \ && apt-get install -y --no-install-recommends $RUN_DEPS \
&& apt-get install -y nano \ && apt-get clean \
&& apt-get install -y --no-install-recommends $RUN_DEPS && rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*
@@ -129,10 +154,25 @@ WORKDIR ${ARCHES_ROOT}
RUN rm -rf /root/.cache/pip/* RUN rm -rf /root/.cache/pip/*
RUN pip install --upgrade pip RUN pip install --upgrade pip
# Install the current stable release of the Arches application and make an Arches project. RUN pip install --force-reinstall -U setuptools
RUN pip install supervisor && pip install pytz --upgrade && pip install tzdata --upgrade && pip install Redis && pip install gunicorn && pip install boto3==1.26 && pip install django-storages==1.14.4 && pip install arches && arches-admin startproject ${ARCHES_PROJECT}
# Make sure we have the environment variables in the python app? # Install the current stable release of the Arches application and make an Arches project.
RUN pip install supervisor \
&& pip install pytz --upgrade \
&& pip install tzdata --upgrade \
&& pip install Redis \
&& pip install gunicorn \
&& pip install boto3==1.26 \
&& pip install django-storages==1.14.4 \
&& pip install arches==${ARCHES_PIP_VERSION}
# create a new Arches project
RUN mkdir -p /new_arches_proj
RUN arches-admin startproject ${ARCHES_PROJECT} --directory /new_arches_proj
RUN mv /new_arches_proj ${APP_ROOT}
# create the uploaded files folder
RUN mkdir -p ${UPLOADED_FILES_FOLDER}
# copia de archivos de idioma es # copia de archivos de idioma es
COPY ./arches/es /opt/venv/lib/python3.12/site-packages/arches/locale/es COPY ./arches/es /opt/venv/lib/python3.12/site-packages/arches/locale/es
@@ -150,9 +190,10 @@ RUN sed -i 's/\r$//g' ${CELERY_PATH}
RUN echo "copied urls to ${URLS_PATH}"; RUN echo "copied urls to ${URLS_PATH}";
COPY ./arches/urls.py ${URLS_PATH} COPY ./arches/urls.py ${URLS_PATH}
RUN sed -i 's/\r$//g' ${URLS_PATH} RUN sed -i 's/\r$//g' ${URLS_PATH}
# Copy the gunicorn_config.py file into our new Arches project. This is used # Copy the gunicorn_config.py file into our new Arches project. This is used
# for running Arches in production (not DEBUG mode) # for running Arches in production (not DEBUG mode)
# NOTE: We're NOT actually using this, because it will throw an error with urls.py # NOTE: We're NOT actually using this, because it will throw an error with urls.py
# So this is here for reference only in case someone wants to edit gunicorn_config.py # So this is here for reference only in case someone wants to edit gunicorn_config.py
# and figure out how to make it work. # and figure out how to make it work.
RUN echo "copy gunicorn_config.py to ${GUNICORN_CONFIG_PATH}"; RUN echo "copy gunicorn_config.py to ${GUNICORN_CONFIG_PATH}";
@@ -205,4 +246,4 @@ EXPOSE 8000
# Expose Webpack port # Expose Webpack port
EXPOSE 8021 EXPOSE 8021
# Expose CouchDB port # Expose CouchDB port
EXPOSE 5984 EXPOSE 5984