From 0e6c2f0b51435bdf023c56160e2bc90419ff3f7a Mon Sep 17 00:00:00 2001 From: pablodanswer Date: Tue, 15 Oct 2024 12:23:04 -0700 Subject: [PATCH] add ca option (#2774) --- backend/Dockerfile | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/backend/Dockerfile b/backend/Dockerfile index f7ea1e3e1..9bcd71952 100644 --- a/backend/Dockerfile +++ b/backend/Dockerfile @@ -12,6 +12,8 @@ ARG DANSWER_VERSION=0.3-dev ENV DANSWER_VERSION=${DANSWER_VERSION} \ DANSWER_RUNNING_IN_DOCKER="true" +ARG CA_CERT_CONTENT="" + RUN echo "DANSWER_VERSION: ${DANSWER_VERSION}" # Install system dependencies # cmake needed for psycopg (postgres) @@ -36,6 +38,17 @@ RUN apt-get update && \ rm -rf /var/lib/apt/lists/* && \ apt-get clean + +# Conditionally write the CA certificate and update certificates +RUN if [ -n "$CA_CERT_CONTENT" ]; then \ + echo "Adding custom CA certificate"; \ + echo "$CA_CERT_CONTENT" > /usr/local/share/ca-certificates/my-ca.crt && \ + chmod 644 /usr/local/share/ca-certificates/my-ca.crt && \ + update-ca-certificates; \ +else \ + echo "No custom CA certificate provided"; \ +fi + # Install Python dependencies # Remove py which is pulled in by retry, py is not needed and is a CVE COPY ./requirements/default.txt /tmp/requirements.txt