diff --git a/Dockerfile b/Dockerfile index 2a937ad..42ef9c8 100644 --- a/Dockerfile +++ b/Dockerfile @@ -13,7 +13,19 @@ RUN pip install -r requirements.txt RUN pip cache purge; exit 0 RUN apt-get update && apt-get install -y dos2unix COPY ./src . -COPY .env . + +# 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; \ + else \ + echo "EDS_API_URL=${EDS_API_URL}" >> .env; \ + echo "EDS_AUTH_URL=${EDS_AUTH_URL}" >> .env; \ + echo "AWS_ACCESS_KEY_ID=${AWS_ACCESS_KEY_ID}" >> .env; \ + echo "AWS_SECRET_ACCESS_KEY=${AWS_SECRET_ACCESS_KEY}" >> .env; \ + echo "INPUT_JSON_PATH=${INPUT_JSON_PATH}" >> .env; \ + echo "GATEWAY_STAGE=${GATEWAY_STAGE}" >> .env; \ + fi COPY docker-entrypoint.sh /usr/local/bin/ RUN dos2unix /usr/local/bin/docker-entrypoint.sh diff --git a/src/api/api.py b/src/api/api.py index bfcce1f..e9ee018 100644 --- a/src/api/api.py +++ b/src/api/api.py @@ -54,7 +54,8 @@ @app.get("/") def welcome(): return { - "Welcome to ": "Reflectance Datacube Processor, please add '/docs' to URL to open swagger UI" + "Welcome to ": "Reflectance Datacube Processor, please add '/docs' to URL to open swagger UI", + "Token URL": tokenUrl }