From 7d131d5f8aba171b6e0ccf5126d9967b9832c689 Mon Sep 17 00:00:00 2001 From: kls Date: Mon, 6 May 2024 17:20:31 -0500 Subject: [PATCH] Update for .env local build --- Dockerfile | 24 +++++++----------------- 1 file changed, 7 insertions(+), 17 deletions(-) diff --git a/Dockerfile b/Dockerfile index 92dc351..a680274 100644 --- a/Dockerfile +++ b/Dockerfile @@ -14,6 +14,12 @@ RUN pip cache purge; exit 0 RUN apt-get update && apt-get install -y dos2unix COPY ./src . +# Check if .env exists, if it does, copy .env file +RUN if [ ! -f .env ]; then \ + cp .env /app/.env; \ + echo "fic exist"; \ + fi + ARG EDS_API_URL ARG EDS_AUTH_URL ARG AWS_ACCESS_KEY_ID @@ -21,12 +27,8 @@ ARG AWS_SECRET_ACCESS_KEY ARG INPUT_JSON_PATH ARG GATEWAY_STAGE -# Check if .env exists, if it does, copy .env file # Otherwise, set up environment variable from build arguments -RUN if [ ! -f .env ]; then \ - # cp .env /app/.env; \ - # echo "fic exist"; \ - # else \ +RUN if [ -f .env ]; then \ echo "fic doesn't exist"; \ echo "EDS_API_URL=${EDS_API_URL}" >> .env; \ echo "valeur EDS_API_URL=${EDS_API_URL}"; \ @@ -38,18 +40,6 @@ RUN if [ ! -f .env ]; then \ echo .env; \ fi -# Intermediate stage to copy .env file if it exists -FROM base AS intermediate - -# Copy .env file into the Docker image -COPY .env /app/ || true - -# Final stage -FROM base - -# Copy files from the intermediate stage -COPY --from=intermediate /app/.env /app/ - COPY docker-entrypoint.sh /usr/local/bin/ RUN dos2unix /usr/local/bin/docker-entrypoint.sh RUN chmod +x /usr/local/bin/docker-entrypoint.sh