Skip to content

Commit

Permalink
optionally install env = prod based on build args
Browse files Browse the repository at this point in the history
  • Loading branch information
GondekNP committed Aug 6, 2024
1 parent 9ef052c commit c723803
Show file tree
Hide file tree
Showing 6 changed files with 36 additions and 21 deletions.
9 changes: 6 additions & 3 deletions .deployment/burn_backend/prod.Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -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 \
Expand All @@ -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
Expand Down
7 changes: 4 additions & 3 deletions .deployment/titiler/prod.Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
##############

FROM condaforge/mambaforge AS base
ARG ENV=PROD

####################
# Environment Stage#
Expand All @@ -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
Expand Down
2 changes: 2 additions & 0 deletions .devcontainer/docker-compose.dev.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ services:
dockerfile: .deployment/titiler/prod.Dockerfile
args:
- DEVCONTAINER_SERVICE=${DEVCONTAINER_SERVICE}
- ENV=LOCAL
ports:
- 8081:8080
volumes:
Expand All @@ -24,6 +25,7 @@ services:
dockerfile: .deployment/burn_backend/prod.Dockerfile
args:
- DEVCONTAINER_SERVICE=${DEVCONTAINER_SERVICE}
- ENV=LOCAL
ports:
- 5051:5050
volumes:
Expand Down
12 changes: 12 additions & 0 deletions .devcontainer/scripts/install_debugpy_in_burn_backend.sh
Original file line number Diff line number Diff line change
@@ -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!"
15 changes: 0 additions & 15 deletions .devcontainer/scripts/install_debugpy_in_docker.sh

This file was deleted.

12 changes: 12 additions & 0 deletions .devcontainer/scripts/install_debugpy_in_titiler.sh
Original file line number Diff line number Diff line change
@@ -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!"

0 comments on commit c723803

Please sign in to comment.