diff --git a/.deployment/burn_backend/prod.Dockerfile b/.deployment/burn_backend/prod.Dockerfile index 4d415adc..9f5820f6 100644 --- a/.deployment/burn_backend/prod.Dockerfile +++ b/.deployment/burn_backend/prod.Dockerfile @@ -3,6 +3,9 @@ ############## FROM condaforge/mambaforge AS base +ARG ENV=PROD + +# Install system dependencies ENV DEBIAN_FRONTEND=noninteractive RUN apt-get update && apt-get install -y \ bash \ @@ -19,9 +22,9 @@ FROM base AS environment COPY .deployment/burn_backend/prod_environment.yml / RUN mamba env create -f prod_environment.yml && echo "conda env create completed" -COPY .devcontainer/scripts/install_debugpy_in_docker.sh /install_debugpy_in_docker.sh -# This does nothing if env var "ENV" is not "LOCAL" -RUN ./install_debugpy_in_docker.sh +# This will only install debugpy if env var ENV is LOCAL at docker build time +COPY .devcontainer/scripts/install_debugpy_in_burn_backend.sh /install_debugpy_in_burn_backend.sh +RUN ./install_debugpy_in_burn_backend.sh #################### # Application Stage diff --git a/.deployment/titiler/prod.Dockerfile b/.deployment/titiler/prod.Dockerfile index b5a31a1e..7cca1013 100644 --- a/.deployment/titiler/prod.Dockerfile +++ b/.deployment/titiler/prod.Dockerfile @@ -3,6 +3,7 @@ ############## FROM condaforge/mambaforge AS base +ARG ENV=PROD #################### # Environment Stage# @@ -12,9 +13,9 @@ FROM base AS environment COPY .deployment/titiler/prod_environment.yml / RUN mamba env create -f prod_environment.yml && echo "conda env create completed" -COPY .devcontainer/scripts/install_debugpy_in_docker.sh /install_debugpy_in_docker.sh -# This does nothing if env var "ENV" is not "LOCAL" -RUN ./install_debugpy_in_docker.sh +# This will only install debugpy if env var ENV is LOCAL at docker build time +COPY .devcontainer/scripts/install_debugpy_in_titiler.sh /install_debugpy_in_titiler.sh +RUN ./install_debugpy_in_titiler.sh #################### # Application Stage diff --git a/.devcontainer/docker-compose.dev.yml b/.devcontainer/docker-compose.dev.yml index 5b4903a5..f34b1197 100644 --- a/.devcontainer/docker-compose.dev.yml +++ b/.devcontainer/docker-compose.dev.yml @@ -6,6 +6,7 @@ services: dockerfile: .deployment/titiler/prod.Dockerfile args: - DEVCONTAINER_SERVICE=${DEVCONTAINER_SERVICE} + - ENV=LOCAL ports: - 8081:8080 volumes: @@ -24,6 +25,7 @@ services: dockerfile: .deployment/burn_backend/prod.Dockerfile args: - DEVCONTAINER_SERVICE=${DEVCONTAINER_SERVICE} + - ENV=LOCAL ports: - 5051:5050 volumes: diff --git a/.devcontainer/scripts/install_debugpy_in_burn_backend.sh b/.devcontainer/scripts/install_debugpy_in_burn_backend.sh new file mode 100755 index 00000000..04a8dfa7 --- /dev/null +++ b/.devcontainer/scripts/install_debugpy_in_burn_backend.sh @@ -0,0 +1,12 @@ +#!/bin/bash + +# Run only if env var ENV is LOCAL +if [ "$ENV" != "LOCAL" ]; then + echo "ENV is not LOCAL. Exiting..." + exit 0 +fi + +# Install debugpy in devcontainer-burn_backend +conda install -n burn-severity-prod debugpy -c conda-forge debugpy -y + +echo "debugpy installed!" \ No newline at end of file diff --git a/.devcontainer/scripts/install_debugpy_in_docker.sh b/.devcontainer/scripts/install_debugpy_in_docker.sh deleted file mode 100755 index f548ec6c..00000000 --- a/.devcontainer/scripts/install_debugpy_in_docker.sh +++ /dev/null @@ -1,15 +0,0 @@ -#!/bin/bash - -# Run only if env var ENV is LOCAL -if [ "$ENV" != "LOCAL" ]; then - echo "ENV is not LOCAL. Exiting..." - exit 0 -fi - -# Install debugpy in devcontainer-burn_backend -docker exec devcontainer-burn_backend-1 conda install -n burn-severity-prod debugpy -c conda-forge debugpy -y - -# Install debugpy in devcontainer-titiler -docker exec devcontainer-titiler-1 conda install -n titiler-prod debugpy -c conda-forge debugpy -y - -echo "debugpy installed in both containers." \ No newline at end of file diff --git a/.devcontainer/scripts/install_debugpy_in_titiler.sh b/.devcontainer/scripts/install_debugpy_in_titiler.sh new file mode 100755 index 00000000..835bb0e7 --- /dev/null +++ b/.devcontainer/scripts/install_debugpy_in_titiler.sh @@ -0,0 +1,12 @@ +#!/bin/bash + +# Run only if env var ENV is LOCAL +if [ "$ENV" != "LOCAL" ]; then + echo "ENV is not LOCAL. Exiting..." + exit 0 +fi + +# Install debugpy in devcontainer-burn_backend +conda install -n titiler-prod debugpy -c conda-forge debugpy -y + +echo "debugpy installed!" \ No newline at end of file