Skip to content

Commit 7246b56

Browse files
authored
Merge pull request #68 from jlab/docker_push
continue working on automatic image build
2 parents 15f5267 + 0990620 commit 7246b56

2 files changed

Lines changed: 38 additions & 14 deletions

File tree

.github/workflows/docker.yml

Lines changed: 18 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,15 +9,28 @@ jobs:
99
docker:
1010
runs-on: ubuntu-latest
1111
steps:
12-
- name: Set up Docker Buildx
13-
uses: docker/setup-buildx-action@v3
12+
- name: Checkout repository
13+
uses: actions/checkout@v4
14+
1415
- name: Login to DockerHub
1516
uses: docker/login-action@v3
1617
with:
17-
username: ${{ secrets.DOCKERHUB_USERNAME }}
18+
username: ${{ vars.DOCKERHUB_USERNAME }}
1819
password: ${{ secrets.DOCKERHUB_TOKEN }}
19-
- name: Build and push
20+
21+
- name: Set up Docker Buildx
22+
uses: docker/setup-buildx-action@v3
23+
24+
- name: Read version from file
25+
id: vars
26+
run: |
27+
VERSION=$(cat instance/example_secret_config.py | grep CAFE_VERSION | cut -d '=' -f 2 | tr -d " " | tr -d '"')
28+
echo "IMAGE_TAG=$VERSION" >> $GITHUB_ENV
29+
30+
- name: Build and push Docker image
2031
uses: docker/build-push-action@v6
2132
with:
33+
context: .
2234
push: true
23-
tags: janssenlab/bellmanscafe:latest
35+
file: Dockerfile
36+
tags: ${{ vars.DOCKERHUB_USERNAME }}/bellmanscafe:${{ env.IMAGE_TAG }}

README.md

Lines changed: 20 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,30 @@
1+
[![Tests_pass](https://github.com/jlab/bellmanscafe/actions/workflows/codestyle.yml/badge.svg?branch=main)](https://github.com/jlab/bellmanscafe/actions/workflows/codestyle.yml) [![Coverage Status](https://coveralls.io/repos/github/jlab/bellmanscafe/badge.svg?branch=main)](https://coveralls.io/github/jlab/bellmanscafe?branch=main)
2+
13
# Bellman's Cafe
24

35
Interactive web-pages to explore Algebraic Dynamic Programming with live examples. Online version at [bellmanscafe.jlab.bio](http://bellmanscafe.jlab.bio)
46

57
# Install
68

79
1. I suggest you follow the instructions of the Dockerfile to see what dependencies need to be installed. In summary (but this list might be incomplete), you need
8-
- gapc (to compile ADP)
9-
- time (for benchmarking)
10-
- graphviz, texlive-latex-extra ghostscript (for grammar- and candidate tree drawings)
11-
- gunicorn flask markdown (for the server)
10+
- gapc (to compile ADP)
11+
- time (for benchmarking)
12+
- graphviz, texlive-latex-extra ghostscript (for grammar- and candidate tree drawings)
13+
- gunicorn flask markdown (for the server)
1214
2. Once all dependencies have been installed, get some ADP example code, e.g. clone https://github.com/jlab/ADP_collection.git
1315
3. Adapt the configuration file. Start from `instance/example_secret_config.py` and create a copy `instance/config.py` and change variables to your needs, especially
14-
- `bind`: try `'0.0.0.0:8000'`
15-
- `workers`: try `1` (1 is nice for debugging as you avoid concurrency, otherwise use higher numbers)
16-
- `accesslog` & `errorlog`: adapt the `DIR_LOGS` infix to an actually existing path
17-
- `FP_CACHE`: also replace `DIR_CACHE` with an actual path
18-
- `FP_GAPC_PROGRAMS`: should point to the ADP example code
16+
- `bind`: try `'0.0.0.0:8000'`
17+
- `workers`: try `1` (1 is nice for debugging as you avoid concurrency, otherwise use higher numbers)
18+
- `accesslog` & `errorlog`: adapt the `DIR_LOGS` infix to an actually existing path
19+
- `FP_CACHE`: also replace `DIR_CACHE` with an actual path
20+
- `FP_GAPC_PROGRAMS`: should point to the ADP example code
1921
4. start the server via `gunicorn -c instance/config.py Bellmansgap:app`
22+
23+
# Host Server
24+
25+
1. Hosting bellmanscafe should be easy as you "just" need to pull/build and than run the docker container.
26+
1. **build**: sudo docker buildx build . -f Dockerfile -t bellmanscafe
27+
2. **pull**: `docker pull janssenlab/bellmanscafe:latest`
28+
2. Once the image is available (through building or pulling), you can run it as an container via `sudo docker run -p 8000:8000 -it bellmanscafe`
29+
- note that you have to forward port 8000 from the container to your host. This port can be re-configured in the Dockerfile
30+
- to make debugging more easy, I suggest you mount two host directories to "/LOGS" and "/CACHE" directories, such that they become persistent even if you restart your container, e.g. by adding `-v /home/sjanssen/bellmanscafe/CACHE/:/CACHE/` and `-v /home/sjanssen/bellmanscafe/LOGS/:/LOGS/` to your `docker build` command. (You need to modify `/home/sjanssen/bellmanscafe` of course!)

0 commit comments

Comments
 (0)