Skip to content

Commit

Permalink
Adding dummy Dash app
Browse files Browse the repository at this point in the history
  • Loading branch information
JBris committed Aug 16, 2024
1 parent b144779 commit 394ba4b
Show file tree
Hide file tree
Showing 4 changed files with 56 additions and 3 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/docker-build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -59,12 +59,12 @@ jobs:
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Docker build
run: bash scripts/docker/build.sh mlflow
run: bash scripts/docker/build.sh app
- name: Login to GitHub Package Registry
uses: docker/login-action@v2
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GHCR_TOKEN }}
- name: Docker push
run: bash scripts/docker/push.sh mlflow
run: bash scripts/docker/push.sh app
26 changes: 26 additions & 0 deletions app/app.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
import pandas as pd
import plotly.express as px
from dash import Dash, Input, Output, callback, dcc, html

df = pd.read_csv(
"https://raw.githubusercontent.com/plotly/datasets/master/gapminder_unfiltered.csv"
)

app = Dash()
server = app.server

app.layout = [
html.H1(children="Title of Dash App", style={"textAlign": "center"}),
dcc.Dropdown(df.country.unique(), "Canada", id="dropdown-selection"),
dcc.Graph(id="graph-content"),
]


@callback(Output("graph-content", "figure"), Input("dropdown-selection", "value"))
def update_graph(value: str) -> px.line:
dff = df[df.country == value]
return px.line(dff, x="year", y="pop")


if __name__ == "__main__":
app.run_server(host="0.0.0.0", port="8000")
23 changes: 23 additions & 0 deletions docker-compose.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,28 @@
services:

app:
image: ghcr.io/jbris/deep-root-gen:${APP_VERSION}
build:
context: .
dockerfile: ./dockerfiles/python/Dockerfile.${APP_VERSION}
args:
BUILD_DATE: date -u +'%Y-%m-%dT%H:%M:%SZ'
restart: always
stop_grace_period: 10s
environment:
MLFLOW_BACKEND_STORE_URI: $MLFLOW_BACKEND_STORE_URI
MLFLOW_S3_ENDPOINT_URL: http://minio:9000
AWS_ACCESS_KEY_ID: $AWS_ACCESS_KEY_ID
AWS_SECRET_ACCESS_KEY: $AWS_SECRET_ACCESS_KEY
PREFECT_URL: http://prefect:4200/api
PREFECT_API_DATABASE_CONNECTION_URL: $PREFECT_API_DATABASE_CONNECTION_URL
ports:
- 8000:8000
volumes:
- ./app/app.py:/app/app.py
command: >
gunicorn -b 0.0.0.0:8000 -w 4 app:server
mlflow:
image: ghcr.io/jbris/deep-root-gen:${APP_VERSION}
build:
Expand Down
6 changes: 5 additions & 1 deletion dockerfiles/python/Dockerfile.0.1.0
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@ COPY README.md README.md

COPY deeprootgen deeprootgen

COPY app/app.py app.py

RUN apt-get update \
&& apt-get install -y --no-install-recommends build-essential libpq-dev graphviz \
&& apt-get clean \
Expand Down Expand Up @@ -40,4 +42,6 @@ ENV VIRTUAL_ENV=/app/.venv \

COPY --from=builder ${VIRTUAL_ENV} ${VIRTUAL_ENV}

RUN chmod -R 755 /app
RUN chmod -R 755 /app

EXPOSE 8000

0 comments on commit 394ba4b

Please sign in to comment.