-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit 2b15d76
Showing
13 changed files
with
556 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
.git/ | ||
.github/ | ||
.dockerignore | ||
Dockerfile | ||
|
||
*~ | ||
*.DS_Store | ||
*.egg-info | ||
__pycache__ | ||
docs/build | ||
.coverage | ||
htmlcov | ||
venv | ||
.docker | ||
|
||
.idea/ | ||
.vscode/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,154 @@ | ||
# Automatically build multi-architectural tagged container images and push them to DockerHub | ||
# https://github.com/FNNDSC/cookiecutter-chrisapp/wiki/Automatic-Builds | ||
# | ||
# - targeted platforms: x86_64, PowerPC64, ARM64 | ||
# - master is built as fnndsc/pl-markimg:latest | ||
# - tagged commits are built as fnndsc/pl-markimg:<tag> | ||
# - tagged commits are also uploaded to chrisstore.co | ||
# | ||
# In order to use this workflow, see | ||
# https://github.com/FNNDSC/cookiecutter-chrisapp/wiki/Automatic-Builds#steps-to-enable | ||
|
||
name: ci | ||
|
||
on: | ||
push: | ||
# we have to guess what the name of the default branch is | ||
branches: [ master, main, trunk ] | ||
tags: [ '**' ] | ||
pull_request: | ||
branches: [ master, main, trunk ] | ||
|
||
jobs: | ||
test: | ||
if: false | ||
runs-on: ubuntu-24.04 | ||
steps: | ||
- uses: actions/checkout@v2 | ||
- name: build | ||
run: docker build -t "${GITHUB_REPOSITORY,,}" . | ||
- name: nose tests | ||
run: docker run "${GITHUB_REPOSITORY,,}" nosetests | ||
|
||
publish: | ||
if: github.event_name == 'push' || github.event_name == 'release' # 1. delete this line | ||
runs-on: ubuntu-24.04 | ||
|
||
# we want to both push the build to DockerHub, but also | ||
# keep a local copy so that we can run | ||
# | ||
# docker run fnndsc/pl-app app --json > App.json | ||
# | ||
# buildx currently does not support multiple output locations, | ||
# neither can multi-architectural builds be loaded into docker. | ||
# Here we use a local registry to cache the build. | ||
services: | ||
registry: | ||
image: registry:2 | ||
ports: | ||
- 5000:5000 | ||
|
||
steps: | ||
- name: Get git tag | ||
id: git_info | ||
if: startsWith(github.ref, 'refs/tags/') | ||
run: echo "::set-output name=tag::${GITHUB_REF##*/}" | ||
- name: Decide image tag name | ||
id: determine | ||
env: | ||
git_tag: ${{ steps.git_info.outputs.tag }} | ||
run: | | ||
repo="${GITHUB_REPOSITORY,,}" # to lower case | ||
# if build triggered by tag, use tag name | ||
tag="${git_tag:-latest}" | ||
dock_image=$repo:$tag | ||
echo $dock_image | ||
echo "::set-output name=dock_image::$dock_image" | ||
echo "::set-output name=repo::$repo" | ||
- uses: actions/checkout@v2 | ||
|
||
# QEMU is for emulating non-x86_64 platforms | ||
- uses: docker/setup-qemu-action@v1 | ||
# buildx is the next-generation docker image builder | ||
- uses: docker/setup-buildx-action@v1 | ||
with: | ||
driver-opts: network=host | ||
# save some time during rebuilds | ||
- name: Cache Docker layers | ||
uses: actions/cache@v2 | ||
with: | ||
path: /tmp/.buildx-cache | ||
key: ${{ runner.os }}-buildx-${{ github.sha }} | ||
restore-keys: | | ||
${{ runner.os }}-buildx- | ||
- name: Login to DockerHub | ||
id: dockerhub_login | ||
uses: docker/login-action@v1 | ||
with: | ||
username: ${{ secrets.DOCKERHUB_USERNAME }} | ||
password: ${{ secrets.DOCKERHUB_PASSWORD }} | ||
|
||
- name: Login to GitHub Container Registry | ||
uses: docker/login-action@v1 | ||
with: | ||
registry: ghcr.io | ||
username: ${{ github.repository_owner }} | ||
password: ${{ secrets.GITHUB_TOKEN }} | ||
|
||
- name: Build and push | ||
uses: docker/build-push-action@v2 | ||
id: docker_build | ||
with: | ||
context: . | ||
file: ./Dockerfile | ||
tags: | | ||
${{ steps.determine.outputs.dock_image }} | ||
localhost:5000/${{ steps.determine.outputs.dock_image }} | ||
ghcr.io/${{ steps.determine.outputs.dock_image }} | ||
platforms: linux/amd64,linux/ppc64le,linux/arm64 | ||
push: true | ||
cache-from: type=local,src=/tmp/.buildx-cache | ||
cache-to: type=local,dest=/tmp/.buildx-cache | ||
|
||
- name: Get plugin meta | ||
id: pluginmeta | ||
run: | | ||
repo=${{ steps.determine.outputs.repo }} | ||
dock_image=${{ steps.determine.outputs.dock_image }} | ||
plname="$(sed 's/^.*\///' <<< $GITHUB_REPOSITORY)" && echo "name=$plname" | ||
docker pull localhost:5000/$dock_image | ||
docker tag localhost:5000/$dock_image $dock_image | ||
script=$(docker inspect --format '{{ (index .Config.Cmd 0) }}' $dock_image) | ||
docker run --rm $dock_image $script --json \ | ||
| jq '. += {"name":"'$plname'", "dock_image": "'$dock_image'", "public_repo": "'${{ github.server_url }}/${{ github.repository }}'" }' \ | ||
> /tmp/description.json | ||
json="$(docker run --rm $dock_image $script --json)" | ||
# Escape single quotes | ||
json_escaped=$(echo "$json" | sed "s/'/\\'/g") | ||
jq <<< "$json" # pretty print in log | ||
echo "json=$json_escaped" >> $GITHUB_OUTPUT | ||
echo "title=$(jq -r '.title' <<< "$json")" >> $GITHUB_OUTPUT | ||
- name: Update DockerHub description | ||
uses: peter-evans/dockerhub-description@v2 | ||
continue-on-error: true # it is not crucial that this works | ||
with: | ||
username: ${{ secrets.DOCKERHUB_USERNAME }} | ||
password: ${{ secrets.DOCKERHUB_PASSWORD }} | ||
short-description: ${{ steps.pluginmeta.outputs.title }} | ||
readme-filepath: ./README.rst | ||
repository: ${{ steps.determine.outputs.repo }} | ||
|
||
- name: Upload ChRIS Plugin | ||
id: upload | ||
if: github.ref_type == 'tag' | ||
uses: FNNDSC/upload-chris-plugin@main | ||
with: | ||
description_file: /tmp/description.json | ||
username: ${{ secrets.CHRISPROJECT_USERNAME }} | ||
password: ${{ secrets.CHRISPROJECT_PASSWORD }} | ||
chris_url: https://cube.chrisproject.org/api/v1/ | ||
compute_names: NERC |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
*~ | ||
*.DS_Store | ||
*.egg-info | ||
__pycache__ | ||
docs/build | ||
.coverage | ||
htmlcov | ||
.docker | ||
.idea/ | ||
.vscode/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
# Docker file for cookie_taste ChRIS plugin app | ||
# | ||
# Build with | ||
# | ||
# docker build -t <name> . | ||
# | ||
# For example if building a local version, you could do: | ||
# | ||
# docker build -t local/pl-cookie_taste . | ||
# | ||
# In the case of a proxy (located at 192.168.13.14:3128), do: | ||
# | ||
# docker build --build-arg http_proxy=http://192.168.13.14:3128 --build-arg UID=$UID -t local/pl-cookie_taste . | ||
# | ||
# To run an interactive shell inside this container, do: | ||
# | ||
# docker run -ti --entrypoint /bin/bash local/pl-cookie_taste | ||
# | ||
# To pass an env var HOST_IP to container, do: | ||
# | ||
# docker run -ti -e HOST_IP=$(ip route | grep -v docker | awk '{if(NF==11) print $9}') --entrypoint /bin/bash local/pl-cookie_taste | ||
# | ||
|
||
FROM python:3.9.1-slim-buster | ||
LABEL maintainer="FNNDSC <[email protected]>" | ||
|
||
WORKDIR /usr/local/src | ||
|
||
COPY requirements.txt . | ||
RUN pip install -r requirements.txt | ||
|
||
COPY . . | ||
RUN pip install . | ||
|
||
CMD ["cookie_taste", "--help"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
MIT License | ||
|
||
Copyright (c) 2024 FNNDSC / BCH | ||
|
||
Permission is hereby granted, free of charge, to any person obtaining a copy | ||
of this software and associated documentation files (the "Software"), to deal | ||
in the Software without restriction, including without limitation the rights | ||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
copies of the Software, and to permit persons to whom the Software is | ||
furnished to do so, subject to the following conditions: | ||
|
||
The above copyright notice and this permission notice shall be included in all | ||
copies or substantial portions of the Software. | ||
|
||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
SOFTWARE. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,113 @@ | ||
pl-cookie_taste | ||
================================ | ||
|
||
.. image:: https://img.shields.io/docker/v/fnndsc/pl-cookie_taste?sort=semver | ||
:target: https://hub.docker.com/r/fnndsc/pl-cookie_taste | ||
|
||
.. image:: https://img.shields.io/github/license/fnndsc/pl-cookie_taste | ||
:target: https://github.com/FNNDSC/pl-cookie_taste/blob/master/LICENSE | ||
|
||
.. image:: https://github.com/FNNDSC/pl-cookie_taste/workflows/ci/badge.svg | ||
:target: https://github.com/FNNDSC/pl-cookie_taste/actions | ||
|
||
|
||
.. contents:: Table of Contents | ||
|
||
|
||
Abstract | ||
-------- | ||
|
||
A simple plugin to demonstrate a working plugin from cookiecutter-chrisapp | ||
|
||
|
||
Description | ||
----------- | ||
|
||
|
||
``cookie_taste`` is a *ChRIS fs-type* application that produces ... by ... | ||
|
||
|
||
Usage | ||
----- | ||
|
||
.. code:: | ||
docker run --rm fnndsc/pl-cookie_taste cookie_taste | ||
[-h|--help] | ||
[--json] [--man] [--meta] | ||
[--savejson <DIR>] | ||
[-v|--verbosity <level>] | ||
[--version] | ||
<inputDir> <outputDir> | ||
Arguments | ||
~~~~~~~~~ | ||
|
||
.. code:: | ||
[-h] [--help] | ||
If specified, show help message and exit. | ||
[--json] | ||
If specified, show json representation of app and exit. | ||
[--man] | ||
If specified, print (this) man page and exit. | ||
[--meta] | ||
If specified, print plugin meta data and exit. | ||
[--savejson <DIR>] | ||
If specified, save json representation file to DIR and exit. | ||
[-v <level>] [--verbosity <level>] | ||
Verbosity level for app. Not used currently. | ||
[--version] | ||
If specified, print version number and exit. | ||
Getting inline help is: | ||
|
||
.. code:: bash | ||
docker run --rm fnndsc/pl-cookie_taste cookie_taste --man | ||
Run | ||
~~~ | ||
|
||
You need to specify input and output directories using the `-v` flag to `docker run`. | ||
|
||
|
||
.. code:: bash | ||
docker run --rm -u $(id -u) \ | ||
-v $(pwd)/in:/incoming -v $(pwd)/out:/outgoing \ | ||
fnndsc/pl-cookie_taste cookie_taste \ | ||
/incoming /outgoing | ||
Development | ||
----------- | ||
|
||
Build the Docker container: | ||
|
||
.. code:: bash | ||
docker build -t local/pl-cookie_taste . | ||
Run unit tests: | ||
|
||
.. code:: bash | ||
docker run --rm local/pl-cookie_taste nosetests | ||
Examples | ||
-------- | ||
|
||
Put some examples here! | ||
|
||
|
||
.. image:: https://raw.githubusercontent.com/FNNDSC/cookiecutter-chrisapp/master/doc/assets/badge/light.png | ||
:target: https://chrisstore.co |
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
from cookie_taste.cookie_taste import Cookie_taste | ||
|
||
|
||
def main(): | ||
chris_app = Cookie_taste() | ||
chris_app.launch() | ||
|
||
|
||
if __name__ == "__main__": | ||
main() |
Oops, something went wrong.