From 07869740e1384df3750a314de0c6cb30776fe2db Mon Sep 17 00:00:00 2001 From: Ng Heng Khai Date: Sat, 4 May 2024 04:03:27 +0800 Subject: [PATCH] Update Dockerfile Added the removal of the package lists to reduce the image size after the install process. --- Dockerfile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Dockerfile b/Dockerfile index 24f8061..4157402 100644 --- a/Dockerfile +++ b/Dockerfile @@ -24,8 +24,8 @@ RUN ./mvnw clean install -DskipTests FROM eclipse-temurin:21-jdk-jammy # Install PostgreSQL and change PostgreSQL authentication to trust. -# Install the PostgreSQL package. -RUN apt-get update && apt-get install -y postgresql +# Install the PostgreSQL package. Remove the package lists to reduce the image size. +RUN apt-get update && apt-get install -y postgresql && && rm -rf /var/lib/apt/lists/* # As a security best practice, switch to a non-root user with user privileges instead of root privileges. # The USER Dockerfile instruction sets the preferred user name (or UID) and optionally the user group (or GID) while running the image — and for any subsequent RUN, CMD, or ENTRYPOINT instructions.