Data extraction module docker file optimisation 86/13786/1
authorMonosij Ghosh <mono.ghosh@samsung.com>
Wed, 27 Nov 2024 09:08:02 +0000 (14:38 +0530)
committerMonosij Ghosh <mono.ghosh@samsung.com>
Wed, 27 Nov 2024 09:08:02 +0000 (14:38 +0530)
Memmory optimisation for docker image

Change-Id: I2b0e5748973409b5357ac4147e418bba6267db01
Signed-off-by: Monosij Ghosh <mono.ghosh@samsung.com>
.dockerignore [new file with mode: 0644]
Dockerfile

diff --git a/.dockerignore b/.dockerignore
new file mode 100644 (file)
index 0000000..10dd1e3
--- /dev/null
@@ -0,0 +1,5 @@
+.git
+*.log
+__pycache__/
+*.pyc
+*.pyo
\ No newline at end of file
index 64f1aa8..90fe426 100644 (file)
 FROM ubuntu:22.04
 
 # location in the container
-ENV TA_DIR /home/app/
+ENV TA_DIR=/home/app
 
-# Install dependencies
-RUN apt-get update && apt-get install -y \
-    python3 && apt-get install -y \
-    python3-pip
+# Setup JAVA_HOME -- useful for docker commandline
+ENV JAVA_HOME=/usr/lib/jvm/java-11-openjdk-amd64/
 
-# Install OpenJDK-11 for Spark
-RUN apt-get update && \
-    apt-get install openjdk-11-jre openjdk-11-jdk -y && \
-    apt-get clean;
+WORKDIR ${TA_DIR}
 
+# Install dependencies
 RUN apt-get update && \
-    apt-get install scala -y && \
-    apt-get clean;
-
-# Setup JAVA_HOME -- useful for docker commandline
-ENV JAVA_HOME /usr/lib/jvm/java-11-openjdk-amd64/
-RUN export JAVA_HOME
+    apt-get install -y --no-install-recommends \
+    python3 \
+    python3-pip \
+    python3-dev \
+    build-essential \
+    openjdk-11-jre \
+    openjdk-11-jdk \
+    scala && \
+    apt-get clean && rm -rf /var/lib/apt/lists/*
 
-WORKDIR ${TA_DIR}
 # Copy sources into the container
 COPY . .
 
 #Install the pip3 requirements
-RUN pip3 install -r requirements.txt
+RUN pip3 install --no-cache-dir -r requirements.txt
 
 #Expose the ports
 EXPOSE 32000