Skip to content

Commit

Permalink
first commit
Browse files Browse the repository at this point in the history
  • Loading branch information
luiztauffer committed Nov 18, 2024
1 parent ed6b12c commit 40fe2c5
Show file tree
Hide file tree
Showing 4 changed files with 130 additions and 0 deletions.
65 changes: 65 additions & 0 deletions .github/workflows/build_and_publish.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
name: Build and Publish Docker Images

on:
push:
branches:
- main
paths:
- '*/**'

jobs:
build:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
app_dir:
- voluseg

steps:
- name: Checkout repository
uses: actions/checkout@v3

- name: Set up Docker Builder
uses: docker/setup-buildx-action@v2

- name: Log in to GitHub Container Registry
uses: docker/login-action@v1
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
# username: YOUR_GITHUB_USERNAME # Replace with your GitHub username
# password: ${{ secrets.GHCR_PAT }} # Use the PAT secret

- name: Pip install dendro
run: |
python -m pip install --upgrade pip
git clone https://github.com/magland/dendro.git
cd dendro/python
git pull
pip install .
- name: Generate Spec File
run: |
cd ${{ matrix.app_dir }}
chmod +x main.py
dendro make-app-spec-file --app-dir . --spec-output-file spec.json
- name: Build and push
run: |
docker build -f ${{ matrix.app_dir }}/Dockerfile -t ghcr.io/catalystneuro/dendro-${{ matrix.app_dir }}:latest .
docker push ghcr.io/catalystneuro/dendro-${{ matrix.app_dir }}:latest
- name: Commit files
run: |
git config --local user.email "github-actions[bot]@users.noreply.github.com"
git config --local user.name "github-actions[bot]"
GIT_STATUS=$(git status -s)
[[ ! -z "$GIT_STATUS" ]] && git add ${{ matrix.app_dir }}/spec.json && git commit -m "update spec.json" -a || echo "No changes to commit"
- name: Push changes
uses: ad-m/github-push-action@master
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
branch: ${{ github.ref }}
26 changes: 26 additions & 0 deletions voluseg/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
FROM ghcr.io/mikarubi/voluseg/voluseg:docs

USER root

# Install git
RUN apt-get update && apt-get install -y git

# Install dendro from github
RUN mkdir -p /src
WORKDIR /src
RUN git clone https://github.com/magland/dendro \
&& cd dendro \
&& cd python \
&& pip install -e .

# Install lindi
RUN pip install lindi

# Install pynwb
RUN pip install pynwb

# Copy files into the container
COPY *.py /app/

# Set the working directory
WORKDIR /app
26 changes: 26 additions & 0 deletions voluseg/VolusegProcessor.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
from dendro.sdk import ProcessorBase, BaseModel, Field, InputFile, OutputFile


class VolusegContext(BaseModel):
input: InputFile = Field(description='Input NWB file in .nwb or .nwb.lindi.tar format')
output: OutputFile = Field(description='Output embedding in .lindi.tar format')
# units_path: str = Field(description='Path to the units table in the NWB file', default='units')
# max_iterations: int = Field(description='Maximum number of iterations', default=1000)
# batch_size: int = Field(description='Batch size', default=1000)
# bin_size_msec: float = Field(description='Bin size in milliseconds', default=20)
# output_dimensions: int = Field(description='Output dimensions', default=10)


class VolusegProcessor(ProcessorBase):
name = 'voluseg_processor'
description = 'Run Voluseg for volumetric segmentation.'
label = 'voluseg_processor'
image = 'catalystneuro/dendro-voluseg:0.1.0'
executable = '/app/main.py'
attributes = {}

@staticmethod
def run(
context: VolusegContext
):
pass
13 changes: 13 additions & 0 deletions voluseg/main.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
from dendro.sdk import App
from VolusegProcessor import VolusegProcessor

app = App(
app_name='voluseg',
description='Voluseg processors'
)

app.add_processor(VolusegProcessor)


if __name__ == '__main__':
app.run()

0 comments on commit 40fe2c5

Please sign in to comment.