diff --git a/configs/docker/build/Dockerfile b/configs/docker/build/Dockerfile index fb37f2078542e9434c18696030700f8ccd7e305f..26242dd196c036610fc9163351adb88490d88106 100644 --- a/configs/docker/build/Dockerfile +++ b/configs/docker/build/Dockerfile @@ -3,10 +3,30 @@ FROM ubuntu:24.04 as base_image SHELL ["/bin/bash", "-c"] +#install system packages +RUN apt-get update;apt-get install --assume-yes python-dev-is-python3 python3-dev python3.11-venv wget unzip emacs gdal-bin libgdal-dev build-essential gfortran zlib1g zlib1g-dev libbz2-dev apt-utils liblzma-dev libcurl4-openssl-dev default-jre openssh-server libfribidi-dev libfontconfig1-dev libspatialindex-dev git; + +#sets the timezone to London +RUN DEBIAN_FRONTEND=noninteractive TZ=Etc/UTC apt-get -y install tzdata + +#these usernames and ids match the production server (IaaS), override when building a local image if needed +ARG GNAME=ews +ARG UNAME=ewsmanager +ARG UID=1006 +ARG GID=1008 +RUN groupadd -g $GID $GNAME +RUN useradd -m -u $UID -g $GID -o -s /bin/bash $UNAME + #run mkdir as root RUN mkdir -p /storage/app/EWS_prod/regions/EastAfrica/workspace RUN mkdir -p /storage/app/EWS_prod/regions/SouthAsia/workspace +RUN chown -R $UNAME /storage + +#swith to the user before installing stuff +USER $UNAME + + #create dirs WORKDIR /home #RUN mkdir /home/ewsmanager/code @@ -15,40 +35,13 @@ WORKDIR /home #COPY ./conda-env-py3EWS-nobuilds.yml . COPY ./requirements.txt . -#install system packages -RUN apt-get update;apt-get install --assume-yes python-dev-is-python3 python3-dev python3.11-venv wget unzip emacs gdal-bin libgdal-dev build-essential gfortran zlib1g zlib1g-dev libbz2-dev apt-utils liblzma-dev libcurl4-openssl-dev default-jre openssh-server libfribidi-dev libfontconfig1-dev libspatialindex-dev git; RUN echo "alias e='emacs -nw $1'" >> ~/.bashrc; RUN alias ll="ls -ltr" -#sets the timezone to London -RUN DEBIAN_FRONTEND=noninteractive TZ=Etc/UTC apt-get -y install tzdata - -# Install miniconda -#ENV CONDA_DIR /storage/app/miniconda3 -#RUN wget --quiet https://repo.anaconda.com/miniconda/Miniconda3-latest-Linux-x86_64.sh -O ~/miniconda.sh \ -# && /bin/bash ~/miniconda.sh -b -p $CONDA_DIR \ -# && rm -v ~/miniconda.sh; -# Put conda in path so we can use conda activate -#ENV PATH=$CONDA_DIR/bin:$PATH - -#build the conda env(s) -#RUN conda env create --file conda-env-py3EWS-nobuilds.yml --prefix /storage/app/EWS_prod/envs/conda/py3EWS +#build the venv RUN python3 -m venv /storage/app/EWS_prod/envs/venv/ews_prod RUN source /storage/app/EWS_prod/envs/venv/ews_prod/bin/activate;pip install -r requirements.txt -#tidy -#RUN rm -v conda-env-py3EWS-nobuilds.yml; -#RUN rm -v requirements.txt; - -#these usernames and ids match the production server (IaaS), override when building a local image if needed -ARG GNAME=ews -ARG UNAME=ewsmanager -ARG UID=1006 -ARG GID=1008 -RUN groupadd -g $GID $GNAME -RUN useradd -m -u $UID -g $GID -o -s /bin/bash $UNAME -USER $UNAME - RUN echo $PYTHONPATH WORKDIR /home/ewsmanager