Skip to content

Commit

Permalink
Update for .env local build
Browse files Browse the repository at this point in the history
  • Loading branch information
KarineGEO6 committed May 6, 2024
1 parent 92bd7c1 commit 7d131d5
Showing 1 changed file with 7 additions and 17 deletions.
24 changes: 7 additions & 17 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -14,19 +14,21 @@ 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
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}"; \
Expand All @@ -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
Expand Down

0 comments on commit 7d131d5

Please sign in to comment.