Skip to content

Commit 46bdc15

Browse files
committed
init commit with WIP app implementation
0 parents  commit 46bdc15

14 files changed

+646
-0
lines changed

.dockerignore

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
.git/
2+
.github/
3+
.gitignore
4+
.dockerignore
5+
Dockerfile
6+
Containerfile
7+
bin/
8+
build/
9+
*~
10+
**/*.pyc
11+
**/__pyche__

.github/for-clams-team.md

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
2+
This directory contains GitHub-related files that help project management and the release process of CLAMS apps.
3+
To use these workflows, your app must be part of `clamsproject` organization.
4+
To create a new repository under the `clamsproject` organization, here's some naming convention to follow.
5+
6+
* App repositories in the `clamsproject` organization should be prefixed with `app-` (e.g., `app-myapp`).
7+
* An app that wraps an extant tool or application should be suffixed with `-wrapper` (e.g., `app-their-app-wrapper`).
8+
* `LICENSE` file should always contain licensing information of the terminal code. If the app is a wrapper, an additional file containing licensing information of the underlying tool must be placed next to the `LICENSE` file when the original license requires so.
9+
10+
(Your "app name" that you used in `clams develop` to create this scaffolding doesn't have to match the repository name.)
11+
12+
In the `workflows` directory, you'll find;
13+
14+
* `issue-apps-project.yml`: this workflow will add all new issues and PRs to our [`apps` project board](https://github.com/orgs/clamsproject/projects/12).
15+
* `issue-assign.yml`: this workflow will assign an issue to the person who created a branch for the issue. A branch is for an issue when its name starts with the `issueNum-` prefix. (e.g., `3-fix` branch is for issue number 3)
16+
* `issue-close.yml`: this workflow will remove all assignee from closed/merged issues and PRs.
17+
* `publish.yml`: this workflow is the main driver for the app release process. A release process is set to be triggered by **any** tag push. To change the trigger edit `on:` part of the file. To change the trigger edit `on.push.tags` part of the file. ([reference](https://docs.github.com/en/actions/using-workflows/events-that-trigger-workflows#running-your-workflow-only-when-a-push-of-specific-tags-occurs)).
18+
* The workflow will
19+
1. build a container image for the app and push it to [the `clamsproject` ghcr](https://github.com/orgs/clamsproject/packages).
20+
2. generate app directory entry files and create a PR to [the app directory repository](https://github.com/clamsproject/apps) for registration.
21+
* **NOTE**: Throughout the entire release process, the git tag that triggered the workflow will be used as the version of the app.
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
name: "🗂 Add new issue to `apps` GHP"
2+
3+
on:
4+
issues:
5+
types:
6+
- opened
7+
- transferred
8+
pull_request_target:
9+
types:
10+
- opened
11+
12+
jobs:
13+
call-assign:
14+
name: "🤙 Call GHP workflow"
15+
uses: clamsproject/.github/.github/workflows/repo-issue-project.yml@main
16+
secrets: inherit
17+
with:
18+
projectnum: 12
19+

.github/workflows/issue-assign.yml

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
name: "🙆 Assign issue"
2+
3+
on:
4+
create:
5+
6+
jobs:
7+
call-assign:
8+
if: github.ref_type == 'branch'
9+
name: "🤙 Call assignment workflow"
10+
uses: clamsproject/.github/.github/workflows/repo-issue-assign.yml@main
11+
secrets: inherit

.github/workflows/issue-close.yml

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
name: "🙅 Unassign assignees"
2+
3+
on:
4+
issues:
5+
types:
6+
- closed
7+
pull_request_target:
8+
types:
9+
- closed
10+
11+
jobs:
12+
call-unassign:
13+
name: "🤙 Call unassignment workflow"
14+
uses: clamsproject/.github/.github/workflows/repo-issue-close.yml@main
15+
secrets: inherit

.github/workflows/publish.yml

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
name: "📦 Publish image>ghcr, metadata>appdir"
2+
3+
on:
4+
workflow_dispatch:
5+
inputs:
6+
tag:
7+
required: true
8+
type: string
9+
description: 'git tag to use to build an app image'
10+
push:
11+
tags:
12+
- '*'
13+
14+
jobs:
15+
set-version:
16+
runs-on: ubuntu-latest
17+
name: "🏷 Set version value"
18+
outputs:
19+
version: ${{ steps.output_version.outputs.version }}
20+
steps:
21+
- name: "📌 Set VERSION value from dispatch inputs"
22+
id: get_version_dispatch
23+
if: ${{ github.event_name == 'workflow_dispatch' }}
24+
run: echo "VERSION=${{ github.event.inputs.tag }}" >> $GITHUB_ENV
25+
- name: "📌 Set VERSION value from pushed tag"
26+
id: get_version_tag
27+
if: ${{ github.event_name == 'push' }}
28+
run: echo "VERSION=$(echo "${{ github.ref }}" | cut -d/ -f3)" >> $GITHUB_ENV
29+
- name: "🏷 Record VERSION for follow-up jobs"
30+
id: output_version
31+
run: |
32+
echo "version=${{ env.VERSION }}" >> $GITHUB_OUTPUT
33+
publish-image:
34+
needs: ['set-version']
35+
name: "🤙 Call app container workflow"
36+
uses: clamsproject/.github/.github/workflows/app-container.yml@main
37+
secrets: inherit
38+
with:
39+
version: ${{ needs.set-version.outputs.version }}
40+
arm64: false
41+
register-appdir:
42+
needs: ['set-version', 'publish-image']
43+
name: "🤙 Call app registration workflow"
44+
uses: clamsproject/apps/.github/workflows/register.yml@main
45+
secrets: inherit
46+
with:
47+
repo: ${{ github.repository }}
48+
tag: ${{ needs.set-version.outputs.version }}
49+
container: 'ghcr.io/${{ github.repository }}:${{ needs.set-version.outputs.version }}'
50+

.gitignore

Lines changed: 164 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,164 @@
1+
# linux
2+
.*.sw?
3+
*~
4+
.directory # KDE directory preferences
5+
.Trash-* # Linux trash folder which might appear on any partition or disk
6+
7+
# macos
8+
.DS_Store
9+
.AppleDouble
10+
.LSOverride
11+
Icon # Icon must end with two \r
12+
._* # Thumbnails
13+
.DocumentRevisions-V100 # Files that might appear in the root of a volume
14+
.fseventsd
15+
.Spotlight-V100
16+
.TemporaryItems
17+
.Trashes
18+
.VolumeIcon.icns
19+
.AppleDB # Directories potentially created on remote AFP share
20+
.AppleDesktop
21+
Network Trash Folder
22+
Temporary Items
23+
.apdisk
24+
25+
# windows
26+
Thumbs.db
27+
ehthumbs.db
28+
Desktop.ini
29+
$RECYCLE.BIN/
30+
*.cab # Windows Installer files
31+
*.msi
32+
*.msm
33+
*.msp
34+
*.lnk # Windows shortcuts
35+
36+
# idea
37+
.idea
38+
*.iml
39+
out
40+
gen
41+
42+
# sqlite
43+
*.db
44+
*.sqlite3
45+
46+
# java
47+
*.class
48+
.mtj.tmp/ # Mobile Tools for Java (J2ME)
49+
target/ # Package Files #
50+
*.jar
51+
*.war
52+
*.ear
53+
hs_err_pid* # virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml
54+
55+
# python byte-compiled / optimized / dll files
56+
__pycache__/
57+
*.py[cod]
58+
*$py.class
59+
60+
# C extensions
61+
*.so
62+
63+
# python Distribution / packaging
64+
.Python
65+
build/
66+
develop-eggs/
67+
dist/
68+
downloads/
69+
eggs/
70+
.eggs/
71+
lib/
72+
lib64/
73+
parts/
74+
sdist/
75+
var/
76+
wheels/
77+
pip-wheel-metadata/
78+
share/python-wheels/
79+
*.egg-info/
80+
.installed.cfg
81+
*.egg
82+
MANIFEST
83+
84+
# python Installer logs
85+
pip-log.txt
86+
pip-delete-this-directory.txt
87+
88+
# python Unit test / coverage reports
89+
htmlcov/
90+
.tox/
91+
.nox/
92+
.coverage
93+
.coverage.*
94+
.cache
95+
nosetests.xml
96+
coverage.xml
97+
*.cover
98+
*.py,cover
99+
.hypothesis/
100+
.pytest_cache/
101+
102+
# Sphinx documentation
103+
docs/_build/
104+
105+
# PyBuilder
106+
target/
107+
108+
# Jupyter Notebook
109+
.ipynb_checkpoints
110+
111+
# IPython
112+
profile_default/
113+
ipython_config.py
114+
115+
# pyenv
116+
.python-version
117+
118+
# pipenv
119+
# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
120+
# However, in case of collaboration, if having platform-specific dependencies or dependencies
121+
# having no cross-platform support, pipenv may install dependencies that don't work, or not
122+
# install all needed dependencies.
123+
#Pipfile.lock
124+
125+
# PEP 582; used by e.g. github.com/David-OConnor/pyflow
126+
__pypackages__/
127+
128+
# Celery stuff
129+
celerybeat-schedule
130+
celerybeat.pid
131+
132+
# SageMath parsed files
133+
*.sage.py
134+
135+
# Virtual Environments
136+
.env
137+
.venv
138+
env/
139+
venv/
140+
ENV/
141+
env.bak/
142+
venv.bak/
143+
144+
# Spyder project settings
145+
.spyderproject
146+
.spyproject
147+
148+
# Rope project settings
149+
.ropeproject
150+
151+
# mkdocs documentation
152+
/site
153+
154+
# mypy
155+
.mypy_cache/
156+
.dmypy.json
157+
dmypy.json
158+
159+
# Pyre type checker
160+
.pyre/
161+
162+
# ctag generated file
163+
tags
164+
.tags

Containerfile

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
# Use the same base image version as the clams-python python library version
2+
FROM ghcr.io/clamsproject/clams-python:1.2.3
3+
# See https://github.com/orgs/clamsproject/packages?tab=packages&q=clams-python for more base images
4+
# IF you want to automatically publish this image to the clamsproject organization,
5+
# 1. you should have generated this template without --no-github-actions flag
6+
# 1. to add arm64 support, change relevant line in .github/workflows/container.yml
7+
# * NOTE that a lots of software doesn't install/compile or run on arm64 architecture out of the box
8+
# * make sure you locally test the compatibility of all software dependencies before using arm64 support
9+
# 1. use a git tag to trigger the github action. You need to use git tag to properly set app version anyway
10+
11+
################################################################################
12+
# DO NOT EDIT THIS SECTION
13+
ARG CLAMS_APP_VERSION
14+
ENV CLAMS_APP_VERSION ${CLAMS_APP_VERSION}
15+
################################################################################
16+
17+
################################################################################
18+
# This is duplicate from the base image Containerfile
19+
# but makes sure the cache directories are consistent across all CLAMS apps
20+
21+
# https://github.com/openai/whisper/blob/ba3f3cd54b0e5b8ce1ab3de13e32122d0d5f98ab/whisper/__init__.py#L130
22+
ENV XDG_CACHE_HOME='/cache'
23+
# https://huggingface.co/docs/huggingface_hub/main/en/package_reference/environment_variables#hfhome
24+
ENV HF_HOME="/cache/huggingface"
25+
# https://pytorch.org/docs/stable/hub.html#where-are-my-downloaded-models-saved
26+
ENV TORCH_HOME="/cache/torch"
27+
28+
RUN mkdir /cache && rm -rf /root/.cache && ln -s /cache /root/.cache
29+
################################################################################
30+
31+
################################################################################
32+
# clams-python base images are based on debian distro
33+
# install more system packages as needed using the apt manager
34+
################################################################################
35+
36+
################################################################################
37+
# main app installation
38+
COPY ./ /app
39+
WORKDIR /app
40+
RUN pip3 install --no-cache-dir -r requirements.txt
41+
42+
# default command to run the CLAMS app in a production server
43+
CMD ["python3", "app.py", "--production"]
44+
################################################################################

LICENSE

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
# Replace this file with the actual license information of the app

0 commit comments

Comments
 (0)