Skip to content

Commit

Permalink
Deploy app to caprover
Browse files Browse the repository at this point in the history
  • Loading branch information
Claudio9701 committed Sep 27, 2024
1 parent 830747e commit 54e2e38
Show file tree
Hide file tree
Showing 5 changed files with 53 additions and 1 deletion.
23 changes: 23 additions & 0 deletions app_classrooms_deficit_estimation/Dockerfile.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
FROM python:3.9.17-slim-bullseye

RUN apt-get update \
# dependencies for building Python packages
&& apt-get install -y build-essential \
# cleaning up unused files
&& apt-get purge -y --auto-remove -o APT::AutoRemove::RecommendsImportant=false \
&& rm -rf /var/lib/apt/lists/*

RUN mkdir -p /usr/src/app
WORKDIR /usr/src/app

COPY ./requirements.txt /requirements.txt
RUN pip install --no-cache-dir -r /requirements.txt \
&& rm -rf /requirements.txt

COPY . /usr/src/app

EXPOSE 8000

RUN chmod +x ./runserver.sh

CMD ["sh", "./runserver.sh"]
4 changes: 3 additions & 1 deletion app_classrooms_deficit_estimation/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -216,6 +216,8 @@ def calculate_extra_salas(name_muni, selected_variables, rows, hex_res):

app = dash.Dash(__name__, external_stylesheets=[dbc.themes.BOOTSTRAP])

server = app.server

# Layout
app.layout = dbc.Container(
[
Expand Down Expand Up @@ -1056,4 +1058,4 @@ def generate_hexagon_maps(df):
return report_components

if __name__ == "__main__":
app.run_server(debug=True)
app.run(debug=True)
4 changes: 4 additions & 0 deletions app_classrooms_deficit_estimation/captain-definition.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"schemaVersion": 2,
"dockerfilePath": "./Dockerfile"
}
11 changes: 11 additions & 0 deletions app_classrooms_deficit_estimation/requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
dash==2.14.2
dash_bootstrap_components==1.5.0
geopandas==0.14.2
h3==3.7.7
numpy==2.1.1
pandas==2.2.3
plotly==5.18.0
Requests==2.32.3
Shapely==2.0.6
urbanpy==0.2.1
gunicorn
12 changes: 12 additions & 0 deletions app_classrooms_deficit_estimation/runserver.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
#!/bin/sh

# Download large file from Google Drive
URL="https://drive.usercontent.google.com/download?id=1U4bFDfcix7UKhCBBRQIgNFEQCFB9uG6P&export=download&confirm=t"
TARGET_DIR="data"
# Create the target directory if it doesn't exist
mkdir -p "$TARGET_DIR"
# Download the file
curl -o "$TARGET_DIR/180724_dashboard_hexs.parquet" "$URL"

# Run the server
gunicorn app:server

0 comments on commit 54e2e38

Please sign in to comment.