Skip to content
This repository was archived by the owner on Jun 19, 2025. It is now read-only.

Commit 95bbdb1

Browse files
authored
Merge pull request #8 from eipm/develop
v.1.0.0
2 parents 2de1417 + a771a79 commit 95bbdb1

36 files changed

+1763
-1
lines changed

.dockerignore

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
README.md
2+
3+
.git
4+
.github
5+
**/stork_v/models
6+
**/data
Lines changed: 86 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,86 @@
1+
name: Docker
2+
3+
on:
4+
push:
5+
# Publish `main` as Docker `latest` image and `develop` as `develop` image.
6+
branches:
7+
- main
8+
- develop
9+
10+
# Publish `v1.2.3` tags as releases.
11+
tags:
12+
- v*
13+
14+
# Run tests for any PRs.
15+
pull_request:
16+
17+
env:
18+
# TODO: Change variable to your image's name.
19+
IMAGE_NAME: stork-v
20+
21+
jobs:
22+
# Push image to GitHub Packages.
23+
# See also https://docs.docker.com/docker-hub/builds/
24+
push:
25+
runs-on: ubuntu-latest
26+
if: github.event_name == 'push'
27+
28+
steps:
29+
- uses: actions/checkout@v2
30+
31+
- name: Build image
32+
run: docker build . --file Dockerfile --tag $IMAGE_NAME
33+
34+
- name: Log into GitHub Container Registry
35+
run: echo "${{ secrets.GHCR_TOKEN }}" | docker login https://ghcr.io -u ${{ secrets.GHCR_SVC_ACCOUNT }} --password-stdin
36+
37+
- name: Push image to GitHub Container Registry
38+
run: |
39+
IMAGE_ID=ghcr.io/${{ github.repository_owner }}/$IMAGE_NAME
40+
41+
# Change all uppercase to lowercase
42+
IMAGE_ID=$(echo $IMAGE_ID | tr '[A-Z]' '[a-z]')
43+
44+
# Strip git ref prefix from version
45+
VERSION=$(echo "${{ github.ref }}" | sed -e 's,.*/\(.*\),\1,')
46+
47+
# Strip "v" prefix from tag name
48+
[[ "${{ github.ref }}" == "refs/tags/"* ]] && VERSION=$(echo $VERSION | sed -e 's/^v//')
49+
50+
# Use Docker `latest` tag convention for main and `develop` for develop
51+
[ "$VERSION" == "main" ] && VERSION=latest
52+
[ "$VERSION" == "develop" ] && VERSION=develop
53+
54+
echo IMAGE_ID=$IMAGE_ID
55+
echo VERSION=$VERSION
56+
57+
docker tag $IMAGE_NAME $IMAGE_ID:$VERSION
58+
docker push $IMAGE_ID:$VERSION
59+
- name: Login to EIPM DockerHub
60+
uses: docker/login-action@v1
61+
with:
62+
username: ${{ secrets.EIPM_DOCKER_HUB_USERNAME }}
63+
password: ${{ secrets.EIPM_DOCKER_HUB_TOKEN }}
64+
65+
- name: Push image to EIPM Docker Hub
66+
run: |
67+
IMAGE_ID=eipm/$IMAGE_NAME
68+
69+
# Change all uppercase to lowercase
70+
IMAGE_ID=$(echo $IMAGE_ID | tr '[A-Z]' '[a-z]')
71+
72+
# Strip git ref prefix from version
73+
VERSION=$(echo "${{ github.ref }}" | sed -e 's,.*/\(.*\),\1,')
74+
75+
# Strip "v" prefix from tag name
76+
[[ "${{ github.ref }}" == "refs/tags/"* ]] && VERSION=$(echo $VERSION | sed -e 's/^v//')
77+
78+
# Use Docker `latest` tag convention for main and `develop` for develop
79+
[ "$VERSION" == "main" ] && VERSION=latest
80+
[ "$VERSION" == "develop" ] && VERSION=develop
81+
82+
echo IMAGE_ID=$IMAGE_ID
83+
echo VERSION=$VERSION
84+
85+
docker tag $IMAGE_NAME $IMAGE_ID:$VERSION
86+
docker push $IMAGE_ID:$VERSION

.gitignore

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -127,3 +127,12 @@ dmypy.json
127127

128128
# Pyre type checker
129129
.pyre/
130+
131+
# Model files
132+
*Model
133+
134+
# zip and avi files
135+
*.zip
136+
!src/static/assets/images/test-images.zip
137+
*.avi
138+
**/data/**

.vscode/launch.json

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
{
2+
// Use IntelliSense to learn about possible attributes.
3+
// Hover to view descriptions of existing attributes.
4+
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
5+
"version": "0.2.0",
6+
"configurations": [
7+
{
8+
"name": "Python: Flask",
9+
"type": "python",
10+
"request": "launch",
11+
"program": "${workspaceFolder}/src/main.py",
12+
"env": {
13+
"USERS_DICT": "{'user1': 'stork'}",
14+
},
15+
"args": [
16+
"run",
17+
"--no-debugger",
18+
"--no-reload"
19+
],
20+
"jinja": true,
21+
"justMyCode": true
22+
}
23+
]
24+
}

Dockerfile

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
FROM python:3.8.16-slim
2+
#===============================#
3+
# Docker Image Configuration #
4+
#===============================#
5+
LABEL org.opencontainers.image.source='https://github.com/eipm/stork-v' \
6+
vendor='Englander Institute for Precision Medicine' \
7+
description='STORK-V' \
8+
maintainer='paz2010@med.cornell.edu' \
9+
base_image='python' \
10+
base_image_version='3.8.16-slim'
11+
12+
ENV APP_NAME='stork-v' \
13+
TZ='US/Eastern'
14+
15+
#===================================#
16+
# Install Prerequisites #
17+
#===================================#
18+
COPY requirements.txt /${APP_NAME}/requirements.txt
19+
RUN apt-get update && apt-get install ffmpeg libsm6 libxext6 -y
20+
RUN pip install --upgrade pip && pip install -r /${APP_NAME}/requirements.txt
21+
#===================================#
22+
# Copy Files and set work directory #
23+
#===================================#
24+
COPY src /${APP_NAME}
25+
WORKDIR /${APP_NAME}
26+
#===================================#
27+
# Startup #
28+
#===================================#
29+
EXPOSE 80
30+
ENV PATH=$PATH:/${APP_NAME}
31+
ENV PYTHONPATH /${APP_NAME}
32+
VOLUME /${APP_NAME}/data
33+
VOLUME /${APP_NAME}/temp
34+
VOLUME /${APP_NAME}/stork_v/models
35+
36+
HEALTHCHECK --interval=30s --timeout=30s --retries=3 \
37+
CMD curl -f -k http://0.0.0.0/api/healthcheck || exit 1
38+
39+
CMD python3 /${APP_NAME}/main.py

README.md

Lines changed: 33 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,33 @@
1-
# stork-v
1+
# stork-v
2+
3+
[![Actions Status](https://github.com/eipm/stork-v/workflows/Docker/badge.svg)](https://github.com/eipm/stork-v/actions) [![Github](https://img.shields.io/badge/github-1.0.0-green?style=flat&logo=github)](https://github.com/eipm/stork-v) [![EIPM Docker Hub](https://img.shields.io/badge/EIPM%20docker%20hub-1.0.0-blue?style=flat&logo=docker)](https://hub.docker.com/repository/docker/eipm/stork-v) [![GitHub Container Registry](https://img.shields.io/badge/GitHub%20Container%20Registry-1.0.0-blue?style=flat&logo=docker)](https://github.com/orgs/eipm/packages/container/package/stork-v) [![Python 3.8.16](https://img.shields.io/badge/python-3.8.16-blue.svg)](https://www.python.org/downloads/release/python-360/) [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
4+
5+
## Set up local environment and install dependencies
6+
7+
Install requirements from requirements.txt
8+
`pip install -r requirements.txt`
9+
10+
Add the models in the folder
11+
`src/stork_v/models`
12+
13+
## Execute a model as script
14+
15+
Add the zip file in the expeted location `src/data/78645636.zip` and run the command
16+
`python src/test.py`
17+
18+
## Docker run command
19+
20+
21+
```
22+
PATH_TO_MODELS=<set the location of your models directory>
23+
PATH_TO_DATA=<set the location of you data directory>
24+
PATH_TO_TEMP=<set the location of the temp directory used for creating the videos>
25+
26+
docker run --name stork-v \
27+
-v $PATH_TO_MODELS:/stork-v/stork_v/models \
28+
-v $PATH_TO_DATA:/stork-v/data \
29+
-v $PATH_TO_TEMP:/stork-v/temp \
30+
-e USERS_DICT="{'user1': 'stork'}" \
31+
-p 8080:80 \
32+
stork-v
33+
```

requirements.txt

Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
absl-py==1.3.0
2+
astunparse==1.6.3
3+
cachetools==5.2.0
4+
certifi==2022.12.7
5+
charset-normalizer==2.1.1
6+
click==8.1.3
7+
Flask==2.2.2
8+
Flask-Cors==3.0.10
9+
flatbuffers==2.0.7
10+
gast==0.4.0
11+
google-auth==2.15.0
12+
google-auth-oauthlib==0.4.6
13+
google-pasta==0.2.0
14+
grpcio==1.51.1
15+
h5py==3.7.0
16+
idna==3.4
17+
importlib-metadata==5.1.0
18+
itsdangerous==2.1.2
19+
Jinja2==3.1.2
20+
joblib==1.2.0
21+
keras==2.7.0
22+
Keras-Preprocessing==1.1.2
23+
libclang==14.0.6
24+
Markdown==3.4.1
25+
MarkupSafe==2.1.1
26+
marshmallow==3.19.0
27+
numpy==1.23.5
28+
oauthlib==3.2.2
29+
opencv-python==4.6.0.66
30+
opt-einsum==3.3.0
31+
packaging==22.0
32+
pandas==1.5.2
33+
protobuf==3.20.3
34+
pyasn1==0.4.8
35+
pyasn1-modules==0.2.8
36+
python-dateutil==2.8.2
37+
pytz==2022.6
38+
requests==2.28.1
39+
requests-oauthlib==1.3.1
40+
rsa==4.9
41+
scikit-learn==1.2.0
42+
scipy==1.9.3
43+
six==1.16.0
44+
tensorboard==2.11.0
45+
tensorboard-data-server==0.6.1
46+
tensorboard-plugin-wit==1.8.1
47+
tensorflow==2.7.0
48+
tensorflow-estimator==2.7.0
49+
tensorflow-io-gcs-filesystem==0.28.0
50+
termcolor==2.1.1
51+
threadpoolctl==3.1.0
52+
typing_extensions==4.4.0
53+
urllib3==1.26.13
54+
Werkzeug==2.2.2
55+
wrapt==1.14.1
56+
zipp==3.11.0

src/.editorconfig

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
# top-most EditorConfig file
2+
root = true
3+
4+
# Unix-style newlines with a newline ending every file
5+
[*]
6+
end_of_line = lf
7+
insert_final_newline = true
8+
trim_trailing_whitespace = true
9+
charset = utf-8
10+
11+
# 4 space indentation
12+
[*.{py,html}]
13+
indent_style = space
14+
indent_size = 4
15+
16+
# 2 space indentation
17+
[*.{js,json,y{a,}ml,cwl}]
18+
indent_style = space
19+
indent_size = 2
20+
21+
[*.{md}]
22+
trim_trailing_whitespace = false
23+
indent_style = space
24+
indent_size = 2

0 commit comments

Comments
 (0)