Skip to content

Commit de17581

Browse files
committed
fix ci
1 parent 798f598 commit de17581

File tree

8 files changed

+66
-37
lines changed

8 files changed

+66
-37
lines changed

.github/workflows/dash.yaml

+6-6
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,12 @@ on: push
33
jobs:
44
mini-app:
55
runs-on: ubuntu-latest
6+
env:
7+
container: dash
68
steps:
79
- uses: actions/checkout@main
8-
- run: |
9-
pip install dash
10-
pip install pandas
11-
- run: python lib/Dash/app.py
12-
timeout-minutes: 1
13-
10+
- run: export DOCKER_BUILDKIT=1
11+
- run: docker build -t dash:latest lib/Dash/davidkhala/dash/app
12+
- run: docker run --name $container -d dash:latest
13+
- run: curl https://raw.githubusercontent.com/davidkhala/containers/refs/heads/main/cli/health.sh | bash -s wait-until-healthy $container
1414

.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
.idea

lib/.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
poetry.lock

lib/Dash/Dockerfile

-7
This file was deleted.

lib/Dash/app.py

-24
This file was deleted.
+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
FROM python
2+
RUN pip install dash
3+
RUN pip install pandas
4+
ADD gapminder_unfiltered.py .
5+
HEALTHCHECK --interval=1s CMD curl --fail http://localhost:8050/health || exit 1
6+
ENTRYPOINT [ "python", "gapminder_unfiltered.py" ]
7+
EXPOSE 8050
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
from dash import Dash, html, dcc, callback, Output, Input
2+
from plotly import express
3+
import pandas
4+
5+
df = pandas.read_csv('https://raw.githubusercontent.com/plotly/datasets/master/gapminder_unfiltered.csv')
6+
7+
app = Dash()
8+
9+
app.layout = [
10+
html.H1(children='Title of Dash App', style={'textAlign': 'center'}),
11+
dcc.Dropdown(df.country.unique(), 'Canada', id='dropdown-selection'),
12+
dcc.Graph(id='graph-content')
13+
]
14+
15+
16+
@callback(
17+
Output('graph-content', 'figure'),
18+
Input('dropdown-selection', 'value')
19+
)
20+
def update_graph(value):
21+
dff = df[df.country == value]
22+
return express.line(dff, x='year', y='pop')
23+
24+
25+
@app.server.route('/health')
26+
def is_health():
27+
return 'OK'
28+
29+
30+
if __name__ == '__main__':
31+
app.run('0.0.0.0', debug=True)

lib/Dash/pyproject.toml

+20
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
[tool.poetry]
2+
name = "davidkhala.dash"
3+
version = "0.0.0"
4+
description = "plotly dash"
5+
authors = ["David Liu <david-khala@hotmail.com>"]
6+
license = "Apache"
7+
readme = "README.md"
8+
packages = [{ include = "davidkhala" }]
9+
10+
[tool.poetry.dependencies]
11+
python = "^3.12"
12+
dash = "*"
13+
14+
15+
[tool.poetry.group.dev.dependencies]
16+
pandas = "*"
17+
18+
[build-system]
19+
requires = ["poetry-core"]
20+
build-backend = "poetry.core.masonry.api"

0 commit comments

Comments
 (0)