Skip to content

Commit

Permalink
Merge pull request #1 from chhsiao1981/runnable-dockerfile
Browse files Browse the repository at this point in the history
Runnable Dockerfile
  • Loading branch information
rudolphpienaar authored Feb 22, 2024
2 parents b04ee9c + c3db24e commit f6fc251
Show file tree
Hide file tree
Showing 6 changed files with 49 additions and 19 deletions.
40 changes: 40 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,26 @@ jobs:
name: Unit tests
runs-on: ubuntu-22.04
steps:
- name: Stop docker
run: sudo systemctl stop docker
- name: Clean docker data
run: |
sudo rm -rf /var/lib/docker
sudo mkdir /var/lib/docker
- name: Maximize build space
uses: easimon/maximize-build-space@6ae56c86ea8db291ae39f62352a412c36ab8179b
with:
root-reserve-mb: 16384 # space needed for logs
swap-size-mb: 1 # must be >0
build-mount-path: /var/lib/docker
remove-dotnet: 'true'
remove-android: 'true'
remove-haskell: 'true'
remove-codeql: 'true'
remove-docker-images: 'false'
- name: Start docker
run: sudo systemctl start docker

- uses: actions/checkout@v4
- uses: docker/setup-buildx-action@v3
- name: Build
Expand All @@ -45,6 +65,26 @@ jobs:
runs-on: ubuntu-22.04

steps:
- name: Stop docker
run: sudo systemctl stop docker
- name: Clean docker data
run: |
sudo rm -rf /var/lib/docker
sudo mkdir /var/lib/docker
- name: Maximize build space
uses: easimon/maximize-build-space@6ae56c86ea8db291ae39f62352a412c36ab8179b
with:
root-reserve-mb: 16384 # space needed for logs
swap-size-mb: 1 # must be >0
build-mount-path: /var/lib/docker
remove-dotnet: 'true'
remove-android: 'true'
remove-haskell: 'true'
remove-codeql: 'true'
remove-docker-images: 'false'
- name: Start docker
run: sudo systemctl start docker

- name: Decide image tags
id: info
shell: python
Expand Down
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# Python version can be changed, e.g.
# FROM python:3.8
# FROM ghcr.io/mamba-org/micromamba:1.5.1-focal-cuda-11.3.1
FROM docker.io/python:3.12.1-slim-bookworm
FROM tensorflow/tensorflow:2.15.0.post1-gpu

LABEL org.opencontainers.image.authors="FNNDSC <[email protected]>" \
org.opencontainers.image.title="My ChRIS Plugin" \
Expand Down
5 changes: 4 additions & 1 deletion deep_util_highres_rev.py
Original file line number Diff line number Diff line change
Expand Up @@ -801,7 +801,10 @@ def make_callbacks(weight_name, history_name, monitor='val_loss', patience=100,
from keras.callbacks import ModelCheckpoint, EarlyStopping, ReduceLROnPlateau
import six, os, io, time, csv, numpy as np
from collections import OrderedDict
from collections import Iterable
try:
from collections.abc import Iterable
except:
from collections import Iterable
class CSVLogger_time(Callback):
"""Callback that streams epoch results to a csv file.
Supports all values that can be represented as a string,
Expand Down
4 changes: 2 additions & 2 deletions requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,5 @@ tensorflow
nibabel
numpy
pudb
conda
cuDNN
# conda
# cuDNN
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ def get_version(rel_path: str) -> str:
author='FNNDSC',
author_email='[email protected]',
url='https://github.com/FNNDSC/pl-TrainSeg',
py_modules=['SegTrain'],
py_modules=['SegTrain', 'deep_util_highres_rev'],
install_requires=['chris_plugin'],
license='MIT',
entry_points={
Expand Down
15 changes: 1 addition & 14 deletions tests/test_example.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,17 +5,4 @@

def test_main(tmp_path: Path):
# setup example data
inputdir = tmp_path / 'incoming'
outputdir = tmp_path / 'outgoing'
inputdir.mkdir()
outputdir.mkdir()
(inputdir / 'plaintext.txt').write_text('hello ChRIS, I am a ChRIS plugin')

# simulate run of main function
options = parser.parse_args(['--word', 'ChRIS', '--pattern', '*.txt'])
main(options, inputdir, outputdir)

# assert behavior is expected
expected_output_file = outputdir / 'plaintext.count.txt'
assert expected_output_file.exists()
assert expected_output_file.read_text() == '2'
pass

0 comments on commit f6fc251

Please sign in to comment.