From 1c017879fcf5b1a7cf446b270ab4ad6395c5965f Mon Sep 17 00:00:00 2001 From: Sebastian Yaghoubi Date: Thu, 26 Dec 2024 12:11:13 -0800 Subject: [PATCH 1/6] refactor(docker): remove unnecessary root user The USER root directive isn't needed directly after FROM Signed-off-by: Sebastian Yaghoubi --- Dockerfile | 2 -- 1 file changed, 2 deletions(-) diff --git a/Dockerfile b/Dockerfile index 0072d9e..b4f48e2 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,7 +1,5 @@ FROM python:3.13-slim-bullseye -USER root - ARG INSTALL_GIT=false RUN if [ "$INSTALL_GIT" = "true" ]; then \ apt-get update && apt-get install -y git && rm -rf /var/lib/apt/lists/*; \ From 4da26d329f0cdddb1d75c4f0c2d3dc7a38c3a864 Mon Sep 17 00:00:00 2001 From: Sebastian Yaghoubi Date: Thu, 26 Dec 2024 12:29:15 -0800 Subject: [PATCH 2/6] fix(docker): use generic nobody nogroup default instead of uid gid Signed-off-by: Sebastian Yaghoubi --- Dockerfile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Dockerfile b/Dockerfile index b4f48e2..ebe4f78 100644 --- a/Dockerfile +++ b/Dockerfile @@ -13,8 +13,8 @@ RUN apt-get update && apt-get install -y --no-install-recommends \ RUN pip install markitdown # Default USERID and GROUPID -ARG USERID=10000 -ARG GROUPID=10000 +ARG USERID=nobody +ARG GROUPID=nogroup USER $USERID:$GROUPID From e5b8b1b5800b4e9e985435c91e7d292b2067ab39 Mon Sep 17 00:00:00 2001 From: Sebastian Yaghoubi Date: Thu, 26 Dec 2024 12:42:28 -0800 Subject: [PATCH 3/6] fix(docker): build app from source locally instead of installing package Signed-off-by: Sebastian Yaghoubi --- Dockerfile | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index ebe4f78..df2bd77 100644 --- a/Dockerfile +++ b/Dockerfile @@ -10,7 +10,9 @@ RUN apt-get update && apt-get install -y --no-install-recommends \ ffmpeg \ && rm -rf /var/lib/apt/lists/* -RUN pip install markitdown +WORKDIR /app +COPY . /app +RUN pip --no-cache-dir install . # Default USERID and GROUPID ARG USERID=nobody From cbeee42f184c6a70e5e2ec5d53e0b3464cbc14e0 Mon Sep 17 00:00:00 2001 From: Sebastian Yaghoubi Date: Thu, 26 Dec 2024 13:31:31 -0800 Subject: [PATCH 4/6] fix(docker): use correct files in dockerignore Signed-off-by: Sebastian Yaghoubi --- .dockerignore | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/.dockerignore b/.dockerignore index f59ec20..e524ad3 100644 --- a/.dockerignore +++ b/.dockerignore @@ -1 +1,5 @@ -* \ No newline at end of file +* +!src/ +!tests/ +!pyproject.toml +!README.md From a02212dc6607d32147f8a95da245c2635f742227 Mon Sep 17 00:00:00 2001 From: Sebastian Yaghoubi Date: Thu, 26 Dec 2024 14:09:58 -0800 Subject: [PATCH 5/6] chore(docker): dont install recommended packages with git Signed-off-by: Sebastian Yaghoubi --- Dockerfile | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index df2bd77..370aa53 100644 --- a/Dockerfile +++ b/Dockerfile @@ -2,7 +2,9 @@ FROM python:3.13-slim-bullseye ARG INSTALL_GIT=false RUN if [ "$INSTALL_GIT" = "true" ]; then \ - apt-get update && apt-get install -y git && rm -rf /var/lib/apt/lists/*; \ + apt-get update && apt-get install -y --no-install-recommends \ + git \ + && rm -rf /var/lib/apt/lists/*; \ fi # Runtime dependency From 310ba02dcbcc6a09865e920e4c9286cd62df23ce Mon Sep 17 00:00:00 2001 From: Sebastian Yaghoubi Date: Thu, 26 Dec 2024 14:10:31 -0800 Subject: [PATCH 6/6] fix(docker): run apt as non-interactive Signed-off-by: Sebastian Yaghoubi --- Dockerfile | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Dockerfile b/Dockerfile index 370aa53..7ef8bfd 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,5 +1,7 @@ FROM python:3.13-slim-bullseye +ENV DEBIAN_FRONTEND=noninteractive + ARG INSTALL_GIT=false RUN if [ "$INSTALL_GIT" = "true" ]; then \ apt-get update && apt-get install -y --no-install-recommends \