Skip to content

Commit

Permalink
fix Dockerfile issues
Browse files Browse the repository at this point in the history
  • Loading branch information
djeck1432 committed Feb 27, 2025
1 parent dd8ebb0 commit 610385b
Show file tree
Hide file tree
Showing 5 changed files with 25 additions and 43 deletions.
13 changes: 3 additions & 10 deletions apps/dashboard_app/.entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,6 @@
set -e # Exit immediately if any command fails

# Wait for the database to be ready
echo "Waiting for database to be ready..."
until PGPASSWORD="$DB_PASSWORD" psql -U "$DB_USER" -d "$DB_NAME" -h "$DB_HOST" -p "$DB_PORT" -c '\q'; do
echo "$POSTGRES_USER" "$POSTGRES_DB"
sleep 2
done
echo "Database is ready."

# Import data from dump file
if [ -f ./derisk_dump_part_aa.sql ]; then
echo "Importing data from derisk_dump_part_aa.sql..."
Expand All @@ -35,6 +28,6 @@ else
done
fi

# Start Streamlit
echo "Starting Streamlit application..."
streamlit run dashboard.py --server.port=8501 --server.address=0.0.0.0
## Start Streamlit
#echo "Starting Streamlit application..."
#streamlit run dashboard.py --server.port=8501 --server.address=0.0.0.0
2 changes: 1 addition & 1 deletion apps/dashboard_app/.env.dev
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# PostgreSQL
DB_USER=postgres
DB_PASSWORD=password
DB_NAME=data_handler
DB_NAME=postgres
DB_HOST=db
DB_PORT=5432
18 changes: 9 additions & 9 deletions apps/dashboard_app/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
FROM python:3.10
FROM python:3.12

RUN apt-get update && apt-get install -y \
postgresql-client \
&& rm -rf /var/lib/apt/lists/*

WORKDIR /app

RUN pip install poetry
COPY legacy_app/pyproject.toml legacy_app/poetry.lock* ./
COPY pyproject.toml poetry.lock* ./
RUN poetry config virtualenvs.create false \
&& poetry install --no-interaction --no-ansi

COPY legacy_app/src legacy_app/src
COPY legacy_app/app.py .
COPY legacy_app/update_data.py .

CMD ["streamlit", "run", "dashboard.py"]
&& poetry install --no-interaction --no-ansi --no-root

COPY . .
ENTRYPOINT ["../.entrypoint.sh"]
20 changes: 0 additions & 20 deletions apps/dashboard_app/dev/Dockerfile

This file was deleted.

15 changes: 12 additions & 3 deletions devops/dev/docker-compose.dashboard-app.yaml
Original file line number Diff line number Diff line change
@@ -1,28 +1,35 @@
version: '3.8'

networks:
dashboard_app_network:
driver: bridge

services:
db:
image: postgres:16
environment:
POSTGRES_USER: ${DB_USER}
POSTGRES_PASSWORD: ${DB_PASSWORD}
POSTGRES_DB: ${DB_NAME}
env_file:
- ../../apps/dashboard_app/.env.dev
volumes:
- postgres_data:/var/lib/postgresql/data
healthcheck:
test: ["CMD-SHELL", "pg_isready -U ${DB_USER} -d ${DB_NAME}"]
interval: 5s
timeout: 5s
retries: 5
networks:
- dashboard_app_network

streamlit:
build:
context: ../../apps
dockerfile: dashboard_app/dev/Dockerfile
context: ../../apps/dashboard_app
ports:
- "8501:8501"
env_file:
- ../../apps/dashboard_app/.env
- ../../apps/dashboard_app/.env.dev
environment:
POSTGRES_USER: ${DB_USER}
POSTGRES_PASSWORD: ${DB_PASSWORD}
Expand All @@ -35,6 +42,8 @@ services:
volumes:
- ../../apps/dashboard_app:/app
entrypoint: /app/.entrypoint.sh
networks:
- dashboard_app_network

volumes:
postgres_data:

0 comments on commit 610385b

Please sign in to comment.