Skip to content

Commit

Permalink
initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
Javier Garcia Ordonez committed Aug 28, 2024
0 parents commit 0aaffea
Show file tree
Hide file tree
Showing 22 changed files with 954 additions and 0 deletions.
41 changes: 41 additions & 0 deletions .cookiecutterrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
# This file exists so you can easily regenerate your project.
#
# `cookiepatcher` is a convenient shim around `cookiecutter`
# for regenerating projects (it will generate a .cookiecutterrc
# automatically for any template). To use it:
#
# pip install cookiepatcher
# cookiepatcher gh:itisfoundation/cookiecutter-osparc-service project-path
#
# See:
# https://pypi.python.org/pypi/cookiepatcher
#
# Alternatively, you can run:
#
# cookiecutter --overwrite-if-exists --config-file=project-path/.cookiecutterrc gh:itisfoundation/cookiecutter-osparc-service
#

default_context:

_checkout: None
_output_dir: '/home/ordonez/osparc_projects/cookiecutter-osparc-service'
_repo_dir: '.'
_template: '.'
author_affiliation: 'ZMT ZurichMedTech AG'
author_email: '[email protected]'
author_name: 'Javier Garcia Ordonez'
contact_email: '[email protected]'
default_docker_registry: 'itisfoundation'
docker_base: 'alpine:3.8'
git_repo: 'github'
git_username: 'JavierGOrdonnez'
number_of_inputs: '4'
number_of_outputs: '4'
project_name: 'Medical Image Processing - Computational Service'
project_package_name: 'comp-medimproc'
project_short_description: 'Medical Image Processing - Computational Service'
project_slug: 'comp-medimproc'
project_type: 'computational'
release_date: '2024'
version: '0.1.0'
version_display: '0.1.0'
47 changes: 47 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
## Common.dockerignore

*
!src/
!service.cli/
!docker/
!.osparc/

# Common
README.md
CHANGELOG.md
docker-compose.yml
Dockerfile

# git
.git
.gitattributes
.gitignore
.git*

## Common.gitignore

# output folders
build/
output/
out/

# temporary folders
tmp/

# explicit mark
*ignore*
.tmp*

# vscode configuration
.vscode

# make outputs
pytest_*.xml
.compose*

# validation folder
!validation/**/*
# docker ignore
!.dockerignore
# git ignore
!.gitignore
32 changes: 32 additions & 0 deletions .github/dockerhub_login.bash
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
#!/bin/bash
# http://redsymbol.net/articles/unofficial-bash-strict-mode/
set -euo pipefail
IFS=$'\n\t'

# check needed variables are defined
if [ ! -v DOCKER_USERNAME ] ||\
[ ! -v DOCKER_PASSWORD ] ||\
[ ! -v DOCKER_REGISTRY ]; then
echo "## ERROR: Please define the environs (DOCKER_USERNAME, DOCKER_PASSWORD, DOCKER_REGISTRY) in your CI settings!"
exit 1
fi

# check script needed variables
if [ ! -v OWNER ]; then
echo "## ERROR: incorrect usage of CI. OWNER (e.g. dockerhub organization like itisfoundation or user private name) not defined!"
exit 1
fi

# only upstream is allowed to push to itisfoundation repo
if [ "${OWNER,,}" != "itisfoundation" ] &&\
{ [ ! -v DOCKER_REGISTRY ] || [ -z "${DOCKER_REGISTRY}" ] || [ "$DOCKER_REGISTRY" = "itisfoundation" ]; }; then
echo "## ERROR: it is not allowed to push to the main dockerhub repository from a fork!"
echo "## Please adapt your CI-defined environs (DOCKER_USERNAME, DOCKER_PASSWORD, DOCKER_REGISTRY)"
exit 1
fi

# these variable must be available securely from the CI
echo "$DOCKER_PASSWORD" | docker login -u "$DOCKER_USERNAME" --password-stdin

echo "logged into dockerhub successfully, ready to push"
exit 0
31 changes: 31 additions & 0 deletions .github/show_system_versions.bash
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
#!/bin/bash
# http://redsymbol.net/articles/unofficial-bash-strict-mode/
set -euo pipefail
IFS=$'\n\t'

echo "------------------------------ environs -----------------------------------"
env

echo "------------------------------ uname -----------------------------------"
uname -a
lsb_release -a

echo "------------------------------ python -----------------------------------"
if command -v python; then
python --version
fi

echo "------------------------------ python3 -----------------------------------"
if command -v python3; then
python3 --version
fi

echo "------------------------------ docker -----------------------------------"
if command -v docker; then
docker version
fi

echo "------------------------------ docker-compose -----------------------------------"
if command -v docker-compose; then
docker-compose version
fi
53 changes: 53 additions & 0 deletions .github/workflows/build-test-publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
name: Github-CI Push/PR comp-medimproc

on:
push:
pull_request:

env:
# secrets can be set in settings/secrets on github
DOCKER_REGISTRY: ${{ secrets.DOCKER_REGISTRY }}
DOCKER_USERNAME: ${{ secrets.DOCKER_USERNAME }}
DOCKER_PASSWORD: ${{ secrets.DOCKER_PASSWORD }}

jobs:
build:
name: building comp-medimproc
runs-on: ${{ matrix.os }}
strategy:
matrix:
python: [3.9]
os: [ubuntu-22.04]
fail-fast: false
steps:
- uses: actions/checkout@v3
- name: setup python environment
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python }}
- name: show versions
run: ./.github/show_system_versions.bash
- name: set owner variable
run: echo "OWNER=${GITHUB_REPOSITORY%/*}" >> $GITHUB_ENV
- name: set docker image tag
if: github.ref != 'refs/heads/master'
run: echo "DOCKER_IMAGE_TAG=${GITHUB_REF##*/}" >> $GITHUB_ENV
- name: get current image if available
run: make pull-latest || true
- name: build
run: |
make VERSION
make build
make info-build
- name: test
run: make tests
# - if: github.event_name == 'push' && github.ref == 'refs/heads/master'
# name: push
# run: |
# ./.github/dockerhub_login.bash
# make push
# - if: github.event_name == 'push' && github.ref != 'refs/heads/master'
# name: push
# run: |
# ./.github/dockerhub_login.bash
# make push-version
24 changes: 24 additions & 0 deletions .github/workflows/check-image.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
name: Build and check image

on: [push, pull_request]

jobs:
verify-image-build:
runs-on: ubuntu-latest
steps:
- name: Checkout repo content
uses: actions/checkout@v2
- name: ooil version
uses: docker://itisfoundation/ci-service-integration-library:v1.0.4
with:
args: ooil --version
- name: Assemble docker compose spec
uses: docker://itisfoundation/ci-service-integration-library:v1.0.4
with:
args: ooil compose
- name: Build all images if multiple
uses: docker://itisfoundation/ci-service-integration-library:v1.0.4
with:
args: docker compose build
- name: test
run: make tests
27 changes: 27 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
## Common.gitignore

# output folders
build/
output/
out/

# temporary folders
tmp/

# explicit mark
*ignore*
.tmp*

# vscode configuration
.vscode

# make outputs
pytest_*.xml
.compose*

# validation folder
!validation/**/*
# docker ignore
!.dockerignore
# git ignore
!.gitignore
6 changes: 6 additions & 0 deletions .osparc/docker-compose.overwrite.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
version: "3.7"
services:
comp-medimproc:
build:
dockerfile: docker/alpine/Dockerfile
target: production
76 changes: 76 additions & 0 deletions .osparc/metadata.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
name: Medical Image Processing - Computational Service
key: simcore/services/comp/comp-medimproc
type: computational
integration-version: 2.0.0
version: 0.1.0
description: Medical Image Processing - Computational Service
contact: [email protected]
thumbnail: https://github.com/ITISFoundation/osparc-assets/blob/cb43207b6be2f4311c93cd963538d5718b41a023/assets/default-thumbnail-cookiecutter-osparc-service.png?raw=true
authors:
- name: Javier Garcia Ordonez
email: [email protected]
affiliation: ZMT ZurichMedTech AG
inputs:
input_1:
displayOrder: 1
label: input_1_label
description: The input 1 description
type: string
defaultValue: some_value(optional)
fileToKeyMap:
somefilename.ext: input_1
input_2:
displayOrder: 2
label: input_2_label
description: The input 2 description
type: string
defaultValue: some_value(optional)
fileToKeyMap:
somefilename.ext: input_2
input_3:
displayOrder: 3
label: input_3_label
description: The input 3 description
type: string
defaultValue: some_value(optional)
fileToKeyMap:
somefilename.ext: input_3
input_4:
displayOrder: 4
label: input_4_label
description: The input 4 description
type: string
defaultValue: some_value(optional)
fileToKeyMap:
somefilename.ext: input_4

outputs:
output_1:
displayOrder: 1
label: output_1_label
description: The input 1 description
type: string
fileToKeyMap:
somefilename.ext: output_1
output_2:
displayOrder: 2
label: output_2_label
description: The input 2 description
type: string
fileToKeyMap:
somefilename.ext: output_2
output_3:
displayOrder: 3
label: output_3_label
description: The input 3 description
type: string
fileToKeyMap:
somefilename.ext: output_3
output_4:
displayOrder: 4
label: output_4_label
description: The input 4 description
type: string
fileToKeyMap:
somefilename.ext: output_4

9 changes: 9 additions & 0 deletions .osparc/runtime.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
restart-policy: no-restart
settings:
- name: Resources
type: Resources
value:
Limits:
NanoCPUs: 1000000000 # 100% of CPU cycles on 1 CPU
MemoryBytes: 2147483648 # 2 Gigabytes

Loading

0 comments on commit 0aaffea

Please sign in to comment.