Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
61 changes: 61 additions & 0 deletions .github/workflows/publish-docker.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
name: Publish docker on GHCR

on:
push:
branches: [main]
workflow_dispatch:
inputs:
force_docker_build:
description: 'Force Docker build (skip change detection)'
required: true
type: boolean
default: false
skip_docker_build:
description: 'Skip Docker build (use last built image)'
required: true
type: boolean
default: false

jobs:
publish-docker:
name: Publish docker
runs-on: ubuntu-latest
permissions:
contents: read
packages: write

steps:
- name: Checkout
uses: actions/checkout@v4

- name: Check if Docker build needed
id: changes
uses: dorny/paths-filter@v3
with:
filters: |
docker:
- 'binder/Dockerfile'
- 'binder/environment.yml'

- name: Login to GitHub Container Registry
if: >
(!inputs.skip_docker_build) &&
(inputs.force_docker_build || steps.changes.outputs.docker == 'true')
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Build the Docker image
if: >
(!inputs.skip_docker_build) &&
(inputs.force_docker_build || steps.changes.outputs.docker == 'true')
uses: docker/build-push-action@v6
with:
context: .
file: binder/Dockerfile
tags: |
ghcr.io/pythonhealthdatascience/llm_simpy_models:latest
push: true

13 changes: 13 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,19 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). Dates formatted as YYYY-MM-DD as per [ISO standard](https://www.iso.org/iso-8601-date-and-time-format.html).

## v1.0.3 - 2025-12-02

Add docker image and hosted on GitHub Container Registry.

### Added

* Add `Dockerfile` which builds conda environment and runs the app.
* Add GitHub action which builds Docker image and pushes to GitHub Container Registry.

### Changed

* Explained how to use Docker (and venv) in README.

## v1.0.2 - 2025-03-25

Add note about `st.spinner()` to the home page.
Expand Down
4 changes: 2 additions & 2 deletions CITATION.cff
Original file line number Diff line number Diff line change
Expand Up @@ -29,5 +29,5 @@ repository-code: 'https://github.com/pythonhealthdatascience/llm_simpy_models'
abstract: >-
The SimPy models and apps generated by LLMs, deployed as a single app.
license: MIT
version: '1.0.2'
date-released: '2025-03-25'
version: '1.0.3'
date-released: '2025-12-02'
50 changes: 49 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,8 @@ For a full record of the generation of these models, please refer to: https://gi

## 🌐 Creating the environment

### conda

The project uses `conda` to manage dependencies. Navigate your terminal to the directory containing the code and run:

```
Expand All @@ -51,7 +53,53 @@ This will create a conda environment called `gen_simpy_apps`. To activate:
conda activate gen_simpy_apps
```

This environment is a simplified version of that from the [llm_simpy](https://github.com/pythonhealthdatascience/llm_simpy) repository, containing only the dependencies required for running the apps.
This environment is a simplified version of that from the [llm_simpy](https://github.com/pythonhealthdatascience/llm_simpy) repository, containing only the dependencies required for running the models and apps.

### venv

Another option is to use `venv`. You can build the environment by running:

```
python -m venv venv
```

Then install the packages using:

```
pip install -r requirements.txt
```

`venv` cannot control which python version is used, it will just use one on system. You can check what this is by running:

```
venv/bin/python --version
```

You can find the version of python used for the models and app in the `binder/environment.yaml` file.

### Docker

Alternatively, a docker environment has been provided.

You can build the image by running:

```
docker build -f binder/Dockerfile -t gen_simpy_apps .
```

Another option is to pull the image from the GitHub Container Registry:

```
docker pull ghcr.io/pythonhealthdatascience/llm_simpy_models:latest
```

Once you have the build image, you can then run the container:

```
docker run -p 8501:8501 gen_simpy_apps
```

Open your browser to <http://localhost:8501/> to view the app.

<br>

Expand Down
26 changes: 26 additions & 0 deletions binder/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
FROM mambaorg/micromamba:latest

# Needed for micromamba activation in Dockerfile RUN commands
ARG MAMBA_DOCKERFILE_ACTIVATE=1

# Workdir inside container
WORKDIR /app

# Copy only env first to leverage layer caching
COPY binder/environment.yml /tmp/environment.yml

# Create the conda env
RUN micromamba env create -f /tmp/environment.yml && \
micromamba clean --all --yes

# Now copy the rest of the project
COPY . /app

# Default environment name; adjust if changes in environment.yml
ENV CONDA_DEFAULT_ENV=gen_simpy_apps
ENV PATH=/opt/conda/envs/gen_simpy_apps/bin:$PATH

EXPOSE 8501

# Use shell-form so the env is active via MAMBA_DOCKERFILE_ACTIVATE
CMD ["streamlit", "run", "Home.py", "--server.address=0.0.0.0", "--server.port=8501"]