Skip to content

Commit

Permalink
Merge pull request #4 from ergodicio/bugfix/docker
Browse files Browse the repository at this point in the history
Mamba docker image
  • Loading branch information
joglekara authored Nov 5, 2024
2 parents 77abdb3 + 92c5cbc commit 65e292f
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 12 deletions.
19 changes: 10 additions & 9 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,18 +1,19 @@
# base image
FROM python:3.12-slim
FROM mambaorg/micromamba:latest

COPY requirements.txt .
COPY stapp.py .
WORKDIR /app

EXPOSE 8501
COPY --chown=$MAMBA_USER:$MAMBA_USER tsadar_gui /app/tsadar_gui
COPY --chown=$MAMBA_USER:$MAMBA_USER mambaenv.yaml tsadar_app.py /app/

RUN micromamba install -y -n base -f /app/mambaenv.yaml && \
micromamba clean --all --yes

# install pip then packages
RUN pip3 install --upgrade pip
RUN pip3 install -r requirements.txt
EXPOSE 8501

CMD streamlit run tsadar.py \
CMD micromamba run -n base streamlit run /app/tsadar_app.py \
--server.headless=true \
--browser.serverAddress="0.0.0.0" \
--server.port=8501 \
--browser.gatherUsageStats=false \
--server.baseUrlPath="/thomson"
--server.baseUrlPath="/tsadar"
12 changes: 12 additions & 0 deletions mambaenv.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
name: base
channels:
- conda-forge
dependencies:
- python=3.12
- git
- pip
- pyhdf
- streamlit
# install pip requirements
- pip:
- git+https://github.com/ergodicio/tsadar.git
5 changes: 3 additions & 2 deletions tsadar_app.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@
config.update("jax_enable_x64", True)

import streamlit as st
import yaml, os
import yaml, os, mlflow
from flatten_dict import flatten, unflatten

from tsadar_gui import config # , plot
from tsadar_gui import config
from tsadar import run_for_app


Expand Down Expand Up @@ -81,6 +81,7 @@ def process_file(file_path):
with c2:
if st.button("Fit"):
# run and wait for the results
mlflow.set_experiment(cfg["mlflow"]["experiment"])
run_id = run_for_app(cfg, mode="fit")

st.write(f"The results can be found at the mlflow run id {run_id}")
Expand Down
2 changes: 1 addition & 1 deletion tsadar_gui/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -426,7 +426,7 @@ def create_default_config():
ion_loss_scale = st.number_input("ion_loss_scale", value=2.0)

st.divider()
st.write("What should we call these?")
st.write("Spectral Fitting Range")
c1, c2 = st.columns(2)
with c1:
blue_min = st.number_input("Blue Min", min_value=400, max_value=510, value=430)
Expand Down

0 comments on commit 65e292f

Please sign in to comment.