diff --git a/Dockerfile b/Dockerfile index ed62c181d0..569f644f3a 100644 --- a/Dockerfile +++ b/Dockerfile @@ -91,7 +91,7 @@ FROM runtime as prod USER root # Get the necessary bits for the health check RUN apt-get update && \ - apt-get install -y curl && \ + apt-get install --no-install-recommends -y curl && \ apt-get clean && \ rm -rf /var/lib/apt/lists/* # Pre-compile packages to .pyc (init speed gains) diff --git a/scripts/docker/tasking-manager/Dockerfile b/scripts/docker/tasking-manager/Dockerfile index 274ebc5f57..09ec524cbb 100644 --- a/scripts/docker/tasking-manager/Dockerfile +++ b/scripts/docker/tasking-manager/Dockerfile @@ -4,18 +4,13 @@ FROM python:${PYTHON_IMG_TAG}-bookworm RUN mkdir -p /usr/src/app WORKDIR /usr/src/app -ENV PATH="/usr/src/app/__pypackages__/${PYTHON_IMG_TAG}/bin:$PATH" \ - PYTHONPATH="/usr/src/app/__pypackages__/${PYTHON_IMG_TAG}/lib" - -# INSTALLATION - # Add repository for node RUN curl -sL https://deb.nodesource.com/setup_16.x | bash - # Install dependencies RUN apt-get update \ && apt-get upgrade -y \ - && apt-get install -y nodejs libgeos-dev \ + && apt-get install -y --no-install-recommends nodejs libgeos-dev \ && apt-get clean && rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* # Upgrade pip @@ -26,6 +21,10 @@ ARG branch=develop RUN git clone --depth=1 git://github.com/hotosm/tasking-manager.git \ --branch $branch /usr/src/app +## Create & use new user to run pdm +RUN useradd --uid 9000 --create-home --home /home/appuser --shell /bin/false appuser +USER appuser:appuser + ## SETUP # Setup backend dependencies @@ -35,7 +34,7 @@ RUN pip install --no-cache-dir pdm \ && pdm install --prod --no-lock --no-editable # Setup and build frontend -RUN cd frontend && npm install && npm run build +RUN cd frontend && npm install --ignore-scripts && npm run build # INITIALIZATION