From 91ddd61cd22318b04cdb12315a1b6c3d3a452426 Mon Sep 17 00:00:00 2001 From: Eero Tamminen Date: Wed, 8 Jan 2025 16:14:00 +0200 Subject: [PATCH] Get security updates & parametrize base image name And fix hadolint warning. Signed-off-by: Eero Tamminen --- Dockerfile | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/Dockerfile b/Dockerfile index e94d1bab1..9b6ad7d07 100644 --- a/Dockerfile +++ b/Dockerfile @@ -4,9 +4,10 @@ # Base image for GenAIComps based OPEA Python applications # Build: docker build -t opea/comps-base -f Dockerfile . -FROM python:3.11-slim +ARG IMAGE_NAME=python +ARG IMAGE_TAG=3.11-slim -RUN apt-get update +FROM ${IMAGE_NAME}:${IMAGE_TAG} AS base ENV HOME=/home/user @@ -14,9 +15,13 @@ RUN useradd -m -s /bin/bash user && \ mkdir -p $HOME && \ chown -R user $HOME +# get security updates +RUN apt-get update && apt-get upgrade -y && \ + apt-get clean && rm -rf /var/lib/apt/lists/* + WORKDIR $HOME -COPY *.toml *.py *.txt *.md LICENSE . +COPY *.toml *.py *.txt *.md LICENSE ./ RUN pip install --no-cache-dir --upgrade pip setuptools && \ pip install --no-cache-dir -r requirements.txt