Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Cloud Deployment I]: Main dockerfile #383

Merged
merged 129 commits into from
Apr 8, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
129 commits
Select commit Hold shift + click to select a range
1ee0231
Create neuroconv_dockerfile
CodyCBakerPhD Mar 27, 2023
ee8873b
Create docker_images.rst
CodyCBakerPhD Mar 27, 2023
a0871e1
Update developer_guide.rst
CodyCBakerPhD Mar 27, 2023
9c148a0
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Mar 27, 2023
91bbd36
add use instructions
CodyCBakerPhD Mar 30, 2023
66a0aff
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Mar 30, 2023
7de44dc
Update neuroconv_dockerfile
CodyCBakerPhD Mar 30, 2023
dee4842
Rename neuroconv_dockerfile to neuroconv_latest_release_dockerfile
CodyCBakerPhD Mar 30, 2023
17031c9
added dev build
CodyCBakerPhD Mar 30, 2023
de6b5f6
Update docker_images.rst
CodyCBakerPhD Mar 30, 2023
a55749e
Merge branch 'main' into add_first_dockerfile
CodyCBakerPhD Mar 30, 2023
37862f2
Update neuroconv_developer_build_dockerfile
CodyCBakerPhD Mar 30, 2023
45fe266
Update docker_images.rst
CodyCBakerPhD Mar 31, 2023
c8d6edd
Update docker_images.rst
CodyCBakerPhD Apr 2, 2023
c3940b7
Update docker_images.rst
CodyCBakerPhD Apr 2, 2023
c3984d3
Create neuroconv_developer_build_auto_config
CodyCBakerPhD Apr 2, 2023
dd0f2a2
Create rclone_auto_config_dockerfile
CodyCBakerPhD Apr 2, 2023
fcea20a
Merge branch 'main' into add_first_dockerfile
CodyCBakerPhD Apr 2, 2023
c406e76
Merge branch 'main' into add_first_dockerfile
CodyCBakerPhD Apr 24, 2023
3488379
Merge branch 'main' into add_first_dockerfile
CodyCBakerPhD Jun 29, 2023
c08ed01
add workflow for docker release
CodyCBakerPhD Jun 29, 2023
e7b5557
add docker publish for dev branch
CodyCBakerPhD Jun 29, 2023
23285ed
initial trigger to show up on interface
CodyCBakerPhD Jun 29, 2023
9a02034
trying to fix dev image publish
CodyCBakerPhD Jun 29, 2023
73ffcba
update username and ghcr name
CodyCBakerPhD Jun 29, 2023
e0c6046
try fixing action path
CodyCBakerPhD Jun 29, 2023
5419ce1
Update neuroconv_developer_build_dockerfile
CodyCBakerPhD Jun 29, 2023
05944f5
retrigger with new credentials
CodyCBakerPhD Jun 29, 2023
a09904f
need to keep push until on main
CodyCBakerPhD Jun 29, 2023
744cb56
Merge branch 'main' into add_first_dockerfile
CodyCBakerPhD Jan 25, 2024
dd481a0
Merge branch 'main' into add_first_dockerfile
bendichter Feb 16, 2024
e8ed3ea
update credentials
CodyCBakerPhD Feb 22, 2024
8330621
try to add tag
CodyCBakerPhD Feb 22, 2024
73a7e16
Update dockerfiles/neuroconv_developer_build_auto_config
CodyCBakerPhD Feb 22, 2024
2479d05
Apply suggestions from code review
CodyCBakerPhD Feb 22, 2024
675abcf
Update .github/workflows/auto-publish-docker-dev-branch.yml
CodyCBakerPhD Feb 22, 2024
323e17f
add docker tests
CodyCBakerPhD Mar 18, 2024
5dd6ffa
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Mar 18, 2024
0d92791
add CI
CodyCBakerPhD Mar 18, 2024
b932329
Merge branch 'main' into add_first_dockerfile
CodyCBakerPhD Mar 18, 2024
99e673b
update installation for pytest checks
CodyCBakerPhD Mar 18, 2024
64f4fee
debug attributes
CodyCBakerPhD Mar 18, 2024
11ac0bb
Merge branch 'main' into add_first_dockerfile
CodyCBakerPhD Mar 21, 2024
729cc81
fix docs rendering
CodyCBakerPhD Mar 21, 2024
da3bd58
improve docs
CodyCBakerPhD Mar 21, 2024
3729115
add full demo
CodyCBakerPhD Mar 21, 2024
055f226
move to user guide
CodyCBakerPhD Mar 21, 2024
51e74f1
add to index
CodyCBakerPhD Mar 21, 2024
18d518f
remove from dev guide
CodyCBakerPhD Mar 21, 2024
778ede9
try non-slim and normal python path
CodyCBakerPhD Mar 21, 2024
2b97324
push once and add manual
CodyCBakerPhD Mar 21, 2024
1b4ad26
remove push after first time
CodyCBakerPhD Mar 21, 2024
f2ca5fb
printout tag in action
CodyCBakerPhD Mar 21, 2024
663ee2e
clarify workflow name
CodyCBakerPhD Mar 21, 2024
9bc34b5
add doc ref
CodyCBakerPhD Mar 21, 2024
3fe08b1
push again for new name
CodyCBakerPhD Mar 21, 2024
56bba2e
specify output directory
CodyCBakerPhD Mar 21, 2024
db81628
set version tag through explicit output
CodyCBakerPhD Mar 21, 2024
09a3ccf
try dot context in v5
CodyCBakerPhD Mar 21, 2024
7d2322b
correct names for latest release
CodyCBakerPhD Mar 21, 2024
65634d7
Merge branch 'main' into add_first_dockerfile
CodyCBakerPhD Mar 21, 2024
67b7ad5
undo push after success
CodyCBakerPhD Mar 21, 2024
586828a
correct docs indent
CodyCBakerPhD Mar 21, 2024
da7835b
polish demo
CodyCBakerPhD Mar 21, 2024
af9e86f
try to determine if slim is the problem
CodyCBakerPhD Mar 21, 2024
b76a18e
re-add push
CodyCBakerPhD Mar 21, 2024
8cb41c7
update dev version too
CodyCBakerPhD Mar 21, 2024
153f95c
shorten
CodyCBakerPhD Mar 21, 2024
edc6e19
adjust dockerfile name
CodyCBakerPhD Mar 21, 2024
1ad92c4
correct file reference
CodyCBakerPhD Mar 21, 2024
5e967fa
update demo
CodyCBakerPhD Mar 21, 2024
714aa4b
swap to conda for git in dev
CodyCBakerPhD Mar 21, 2024
2a0896d
debugging dev file
CodyCBakerPhD Mar 21, 2024
019cf5c
include szonja fix
CodyCBakerPhD Mar 21, 2024
62d0b49
debug dev file
CodyCBakerPhD Mar 21, 2024
ab82d22
cancel past triggers
CodyCBakerPhD Mar 21, 2024
25f080f
cancel past triggers
CodyCBakerPhD Mar 21, 2024
d07d750
debug dev file
CodyCBakerPhD Mar 21, 2024
e5a6e63
move docker tests out of main scopes
CodyCBakerPhD Mar 21, 2024
33b7b4c
clarify docs
CodyCBakerPhD Mar 21, 2024
22434b6
dev file debugging
CodyCBakerPhD Mar 21, 2024
eab9ab2
move rclone stuff to other branch
CodyCBakerPhD Mar 21, 2024
ff95795
re-order user guide
CodyCBakerPhD Mar 21, 2024
088026a
update dev docs
CodyCBakerPhD Mar 21, 2024
2bf30e3
update yaml variable dockerfile
CodyCBakerPhD Mar 21, 2024
47967b9
adjust name
CodyCBakerPhD Mar 21, 2024
d590878
add workflow for YAML alternative
CodyCBakerPhD Mar 21, 2024
b3423e8
adjust docker test
CodyCBakerPhD Mar 21, 2024
8ccace1
add test for yaml variable
CodyCBakerPhD Mar 21, 2024
60bf1d5
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Mar 21, 2024
5589e2f
update dockerfile with flags
CodyCBakerPhD Mar 21, 2024
32c18f8
update dev docs
CodyCBakerPhD Mar 21, 2024
7f4f5d1
remove push
CodyCBakerPhD Mar 21, 2024
1a3771d
Update CHANGELOG.md
CodyCBakerPhD Mar 21, 2024
7601724
bypass git, just do direct local install
CodyCBakerPhD Mar 21, 2024
f3dee1b
fix scope
CodyCBakerPhD Mar 21, 2024
8278e57
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Mar 21, 2024
3bc6b30
Update docker_testing.yml
CodyCBakerPhD Mar 21, 2024
03e5fff
Update neuroconv_dev_dockerfile
CodyCBakerPhD Mar 21, 2024
f20acba
Update build_and_upload_docker_image_dev.yml
CodyCBakerPhD Mar 21, 2024
58990b7
Update neuroconv_dev_dockerfile
CodyCBakerPhD Mar 21, 2024
2423f28
debugs to tests
CodyCBakerPhD Mar 21, 2024
339ee36
Update build_and_upload_docker_image_dev.yml
CodyCBakerPhD Mar 21, 2024
b18465d
debug environment variable paths
CodyCBakerPhD Mar 21, 2024
843049d
printout docker results; remove one test case
CodyCBakerPhD Mar 21, 2024
f50ffab
correct GHCR base
CodyCBakerPhD Mar 21, 2024
bce202d
force rebuild
CodyCBakerPhD Mar 21, 2024
8172be5
restore login
CodyCBakerPhD Mar 21, 2024
e4666d0
debugging
CodyCBakerPhD Mar 22, 2024
61ccba5
debugging
CodyCBakerPhD Mar 22, 2024
a7a91a1
debugging
CodyCBakerPhD Mar 22, 2024
36d52f4
debugging
CodyCBakerPhD Mar 22, 2024
008d448
debugging
CodyCBakerPhD Mar 22, 2024
45aafee
try to pull images first
CodyCBakerPhD Mar 22, 2024
0aa5d28
already was apparently
CodyCBakerPhD Mar 22, 2024
38206fc
add missing quotes
CodyCBakerPhD Mar 22, 2024
abc7a24
add missing f-string
CodyCBakerPhD Mar 22, 2024
9ce262a
add description
CodyCBakerPhD Mar 22, 2024
a6ab697
add description
CodyCBakerPhD Mar 22, 2024
29cbcc5
add description
CodyCBakerPhD Mar 22, 2024
87704f3
try this
CodyCBakerPhD Mar 22, 2024
36ce2c0
remove pushes; add date tag to dev
CodyCBakerPhD Mar 22, 2024
0e246b8
increase dev to weekly
CodyCBakerPhD Mar 22, 2024
8f5bdbc
one last rebuild
CodyCBakerPhD Mar 22, 2024
1669604
try without provenance
CodyCBakerPhD Mar 22, 2024
d7858bd
try without provenance
CodyCBakerPhD Mar 22, 2024
d4ddb67
disable all push
CodyCBakerPhD Mar 22, 2024
87e5373
disable all push
CodyCBakerPhD Mar 22, 2024
c29264e
Merge branch 'main' into add_first_dockerfile
CodyCBakerPhD Apr 8, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
41 changes: 41 additions & 0 deletions .github/workflows/build_and_upload_docker_image_dev.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
name: Build and Upload Docker Image of Current Dev Branch to GHCR

on:
schedule:
- cron: "0 16 * * 1" # Weekly at noon EST on Monday
workflow_dispatch:

concurrency: # Cancel previous workflows on the same pull request
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

jobs:
release-image:
name: Build and Upload Docker Image of Current Dev Branch to GHCR
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Login to GitHub Container Registry
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ secrets.DOCKER_UPLOADER_USERNAME }}
password: ${{ secrets.DOCKER_UPLOADER_PASSWORD }}
- name: Get current date
id: date
run: |
date_tag="$(date +'%Y-%m-%d')"
echo "date_tag=$date_tag" >> $GITHUB_OUTPUT
- name: Build and push
uses: docker/build-push-action@v5
with:
push: true # Push is a shorthand for --output=type=registry
tags: ghcr.io/catalystneuro/neuroconv:dev,ghcr.io/catalystneuro/neuroconv:${{ steps.date.outputs.date_tag }}
context: .
file: dockerfiles/neuroconv_dev_dockerfile
provenance: false
46 changes: 46 additions & 0 deletions .github/workflows/build_and_upload_docker_image_latest_release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
name: Build and Upload Docker Image of Latest Release to GHCR

on:
workflow_run:
workflows: [auto-publish]
types: [completed]
workflow_dispatch:

concurrency: # Cancel previous workflows on the same pull request
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

jobs:
release-image:
name: Build and Upload Docker Image of Latest Release to GHCR
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Parse the version from the GitHub latest release tag
id: parsed_version
run: |
git fetch --prune --unshallow --tags
tags="$(git tag --list)"
version_tag=${tags: -6 : 6}
echo "version_tag=$version_tag" >> $GITHUB_OUTPUT
- name: Printout parsed version for GitHub Action log
run: echo ${{ steps.parsed_version.outputs.version_tag }}
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Login to GitHub Container Registry
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ secrets.DOCKER_UPLOADER_USERNAME }}
password: ${{ secrets.DOCKER_UPLOADER_PASSWORD }}
- name: Build and push
uses: docker/build-push-action@v5
with:
push: true # Push is a shorthand for --output=type=registry
tags: ghcr.io/catalystneuro/neuroconv:latest,ghcr.io/catalystneuro/neuroconv:${{ steps.parsed_version.outputs.version_tag }}
context: .
file: dockerfiles/neuroconv_latest_release_dockerfile
provenance: false
37 changes: 37 additions & 0 deletions .github/workflows/build_and_upload_docker_image_yaml_variable.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
name: Build and Upload Docker Image of latest with YAML variable to GHCR

on:
workflow_run:
workflows: [build_and_upload_docker_image_latest_release]
types: [completed]
workflow_dispatch:

concurrency: # Cancel previous workflows on the same pull request
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

jobs:
release-image:
name: Build and Upload Docker Image of latest with YAML variable to GHCR
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Login to GitHub Container Registry
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ secrets.DOCKER_UPLOADER_USERNAME }}
password: ${{ secrets.DOCKER_UPLOADER_PASSWORD }}
- name: Build and push YAML variable image based on latest
uses: docker/build-push-action@v5
with:
push: true # Push is a shorthand for --output=type=registry
tags: ghcr.io/catalystneuro/neuroconv:yaml_variable
context: .
file: dockerfiles/neuroconv_latest_yaml_variable
provenance: false
82 changes: 82 additions & 0 deletions .github/workflows/docker_testing.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
name: Docker CLI tests
on:
schedule:
- cron: "0 16 * * *" # Daily at noon EST
workflow_dispatch:

jobs:
run:
name: ${{ matrix.os }} Python ${{ matrix.python-version }}
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
python-version: ["3.12"]
os: [ubuntu-latest] #, macos-latest, windows-latest] # Seems docker might only be available for ubuntu on GitHub Actions
steps:
- uses: actions/checkout@v4
- run: git fetch --prune --unshallow --tags
- name: Setup Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}

- name: Global Setup
run: python -m pip install -U pip # Official recommended way

- name: Install pytest and neuroconv minimal
run: |
pip install pytest
pip install .

- name: Get ephy_testing_data current head hash
id: ephys
run: echo "::set-output name=HASH_EPHY_DATASET::$(git ls-remote https://gin.g-node.org/NeuralEnsemble/ephy_testing_data.git HEAD | cut -f1)"
- name: Cache ephys dataset - ${{ steps.ephys.outputs.HASH_EPHY_DATASET }}
uses: actions/cache@v4
id: cache-ephys-datasets
with:
path: ./ephy_testing_data
key: ephys-datasets-2023-06-26-${{ matrix.os }}-${{ steps.ephys.outputs.HASH_EPHY_DATASET }}
- name: Get ophys_testing_data current head hash
id: ophys
run: echo "::set-output name=HASH_OPHYS_DATASET::$(git ls-remote https://gin.g-node.org/CatalystNeuro/ophys_testing_data.git HEAD | cut -f1)"
- name: Cache ophys dataset - ${{ steps.ophys.outputs.HASH_OPHYS_DATASET }}
uses: actions/cache@v4
id: cache-ophys-datasets
with:
path: ./ophys_testing_data
key: ophys-datasets-2022-08-18-${{ matrix.os }}-${{ steps.ophys.outputs.HASH_OPHYS_DATASET }}
- name: Get behavior_testing_data current head hash
id: behavior
run: echo "::set-output name=HASH_BEHAVIOR_DATASET::$(git ls-remote https://gin.g-node.org/CatalystNeuro/behavior_testing_data.git HEAD | cut -f1)"
- name: Cache behavior dataset - ${{ steps.behavior.outputs.HASH_BEHAVIOR_DATASET }}
uses: actions/cache@v4
id: cache-behavior-datasets
with:
path: ./behavior_testing_data
key: behavior-datasets-2023-07-26-${{ matrix.os }}-${{ steps.behavior.outputs.HASH_behavior_DATASET }}

- if: steps.cache-ephys-datasets.outputs.cache-hit != 'true' || steps.cache-ophys-datasets.outputs.cache-hit != 'true' || steps.cache-behavior-datasets.outputs.cache-hit != 'true'
name: Install and configure AWS CLI
run: |
pip install awscli
aws configure set aws_access_key_id ${{ secrets.AWS_ACCESS_KEY_ID }}
aws configure set aws_secret_access_key ${{ secrets.AWS_SECRET_ACCESS_KEY }}
- if: steps.cache-ephys-datasets.outputs.cache-hit != 'true'
name: Download ephys dataset from S3
run: aws s3 cp --recursive ${{ secrets.S3_GIN_BUCKET }}/ephy_testing_data ./ephy_testing_data
- if: steps.cache-ophys-datasets.outputs.cache-hit != 'true'
name: Download ophys dataset from S3
run: aws s3 cp --recursive ${{ secrets.S3_GIN_BUCKET }}/ophys_testing_data ./ophys_testing_data
- if: steps.cache-behavior-datasets.outputs.cache-hit != 'true'
name: Download behavior dataset from S3
run: aws s3 cp --recursive ${{ secrets.S3_GIN_BUCKET }}/behavior_testing_data ./behavior_testing_data

- name: Pull docker image
run: |
docker pull ghcr.io/catalystneuro/neuroconv:latest
docker pull ghcr.io/catalystneuro/neuroconv:yaml_variable

- name: Run docker tests
run: pytest tests/docker_yaml_conversion_specification_cli.py -vv -rsx
11 changes: 8 additions & 3 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,12 +1,17 @@
# Upcoming

### Bug fixes
* Fixed writing waveforms directly to file [PR #799](https://github.com/catalystneuro/neuroconv/pull/799)

### Deprecations
* Removed `stream_id` as an argument from `IntanRecordingInterface` [PR #794](https://github.com/catalystneuro/neuroconv/pull/794)
* Replaced `waveform_extractor.is_extension` with `waveform_extractor.has_extension`[PR #799](https://github.com/catalystneuro/neuroconv/pull/799)

### Features
* Released the first official Docker images for the package on the GitHub Container Repository (GHCR). [PR #383](https://github.com/catalystneuro/neuroconv/pull/383)

### Bug fixes
* Fixed writing waveforms directly to file [PR #799](https://github.com/catalystneuro/neuroconv/pull/799)



# v0.4.8 (March 20, 2024)

### Bug fixes
Expand Down
6 changes: 6 additions & 0 deletions dockerfiles/neuroconv_dev_dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
FROM python:3.11.7-slim
LABEL org.opencontainers.image.source=https://github.com/catalystneuro/neuroconv
LABEL org.opencontainers.image.description="A docker image for the most recent daily build of the main branch."
ADD ./ neuroconv
RUN cd neuroconv && pip install .[full]
CMD ["python -m"]
6 changes: 6 additions & 0 deletions dockerfiles/neuroconv_latest_release_dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
FROM python:3.11.7-slim
LABEL org.opencontainers.image.source=https://github.com/catalystneuro/neuroconv
CodyCBakerPhD marked this conversation as resolved.
Show resolved Hide resolved
LABEL org.opencontainers.image.description="A docker image for the most recent official release of the NeuroConv package."
RUN apt update && apt install musl-dev python3-dev -y
RUN pip install neuroconv[full]
CMD ["python -m"]
4 changes: 4 additions & 0 deletions dockerfiles/neuroconv_latest_yaml_variable
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
FROM ghcr.io/catalystneuro/neuroconv:latest
LABEL org.opencontainers.image.source=https://github.com/catalystneuro/neuroconv
LABEL org.opencontainers.image.description="A docker image for the most recent official release of the NeuroConv package. Modified to take in environment variables for the YAML conversion specification and other command line arguments."
CMD echo "$NEUROCONV_YAML" > run.yml && python -m neuroconv run.yml --data-folder-path "$NEUROCONV_DATA_PATH" --output-folder-path "$NEUROCONV_OUTPUT_PATH" --overwrite
1 change: 1 addition & 0 deletions docs/developer_guide.rst
Original file line number Diff line number Diff line change
Expand Up @@ -15,5 +15,6 @@ The most common contribution is for a user/developer to help us integrate a new
Testing Suite <developer_guide/testing_suite>
Coding Style <developer_guide/style_guide>
Building the Documentation <developer_guide/building_documentation>
Building the Docker Image <developer_guide/docker_images.rst>

Or feel free to raise a `bug report <https://github.com/catalystneuro/neuroconv/issues/new?assignees=&labels=bug&template=bug_report.yml&title=%5BBug%5D%3A+>`_ or `feature request <https://github.com/catalystneuro/neuroconv/issues/new?assignees=&labels=enhancement&template=feature_request.yml&title=%5BFeature%5D%3A+>`_ for our maintainers to prioritize!
96 changes: 96 additions & 0 deletions docs/developer_guide/docker_images.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,96 @@
Manually Build Docker Images
----------------------------

.. note::

It is recommended to build the docker image on the same system architecture that you intend to run it on, *i.e.*, AWS Linux AMI 64-bit (x86), as it may experience difficulties running on other significantly different systems (like an M1 Mac).

.. note::

The NeuroConv docker container comes prepackaged with all required installations, equivalent to running ``pip install neuroconv[full]``. As such it is relatively heavy, so be sure that whatever environment you intend to use it in (such as in continuous integration) has sufficient disk space.


Latest Release
~~~~~~~~~~~~~~

To manually build the most recent release, navigate to the ``neuroconv/dockerfiles`` folder and run...

.. code::

docker build -f neuroconv_latest_release_dockerfile -t neuroconv_latest_release .


Dev Branch
~~~~~~~~~~

Checkout to a specific branch on a local clone, then...

.. code::

docker build -f neuroconv_dev_dockerfile -t neuroconv_dev .



Publish Container to GitHub
---------------------------

The ``LABEL`` is important to include as it determines the host repository on the GitHub Container Registry (GHCR). In each dockerfile we wish to publish on the GHCR, we will add this label right after the ``FROM`` clause...

.. code::

FROM PARENT_IMAGE:TAG
LABEL org.opencontainers.image.source=https://github.com/catalystneuro/neuroconv

After building the image itself, we can publish the container with...

.. code::

docker tag IMAGE_NAME ghcr.io/catalystneuro/IMAGE_NAME:TAG
export CR_PAT="<YOUR GITHUB SECRET TOKEN>"
echo $CR_PAT | docker login ghcr.io -u <YOUR GITHUB USERNAME> --password-stdin
docker push ghcr.io/catalystneuro/IMAGE_NAME:TAG

.. note::

Though it may appear confusing, the use of the ``IMAGE_NAME`` in these steps determines only the _name_ of the package as available from the 'packages' screen of the host repository; the ``LABEL`` itself ensured the upload and linkage to the NeuroConv GHCR.



Run Docker container on local YAML conversion specification file
----------------------------------------------------------------

You can either perform a manual build locally following the instructions above, or pull the container from the GitHub Container Registry (GHCR) with...

.. code::

docker pull ghcr.io/catalystneuro/neuroconv:latest

and can then run the entrypoint (equivalent to the usual command line usage) on a YAML specification file (named ``your_specification_file.yml``) with...

.. code::

docker run -it --volume /your/local/volume/:/desired/alias/of/volume/ ghcr.io/catalystneuro/neuroconv:latest neuroconv /desired/alias/of/drive/your_specification_file.yml



Run Docker container on YAML conversion specification environment variable
--------------------------------------------------------------------------

An alternative approach that simplifies usage on systems such as AWS Batch is to specify the YAML contents as an environment variable. The YAML file is constructed in the first step of the container launch.

The only potential downside with this usage is the maximum size of an environment variable (~13,000 characters). Typical YAML specification files should not come remotely close to this limit.

Otherwise, in any cloud deployment, the YAML file transfer will have to be managed separately, likely as a part of the data transfer or an entirely separate step.

To use this alternative image on a local environment, you no longer need to invoke the ``neuroconv`` entrypoint pointing to a file. Instead, just set the environment variables and run the docker container on the mounted volume...

.. code::

export YAML_STREAM="<copy and paste contents of YAML file (manually replace instances of double quotes with single quotes)>"
export NEUROCONV_DATA_PATH="/desired/alias/of/volume/"
export NEUROCONV_OUTPUT_PATH="/desired/alias/of/volume/"
docker run -it --volume /your/local/volume/:/desired/alias/of/volume/ ghcr.io/catalystneuro/neuroconv:yaml_variable

.. note::

On Windows, use ``set`` instead of ``export``.
1 change: 1 addition & 0 deletions docs/developer_guide/testing_suite.rst
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ These can be run in isolation using ``pip install -e neuroconv[test,<modality>]`
``pytest tests/test_<modality>`` where ``<modality>`` can be any of ``ophys``, ``ecephys``, ``text``, or ``behavior``.


.. _example_data:

Testing On Example Data
-----------------------
Expand Down
Loading
Loading