-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add Docker image and example scripts (#47)
* Add docker image * Add shell script to analyse images in a containerised instance of ColonyScanalyser * Add shell script to build docker image * Version bump and update documentation with Docker information
- Loading branch information
1 parent
7827d54
commit f876ca7
Showing
9 changed files
with
157 additions
and
3 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,94 @@ | ||
# Project specific | ||
data/ | ||
images/ | ||
figures/ | ||
site/ | ||
docs/images/ | ||
tests/ | ||
|
||
# Git | ||
.git | ||
.gitignore | ||
|
||
# CI | ||
.codeclimate.yml | ||
.travis.yml | ||
.taskcluster.yml | ||
|
||
# Docker | ||
docker-compose.yml | ||
.docker | ||
|
||
# Byte-compiled / optimized / DLL files | ||
__pycache__/ | ||
**/__pycache__/ | ||
**/*.py[cod] | ||
**/*.pyc | ||
|
||
# C extensions | ||
*.so | ||
|
||
# Distribution / packaging | ||
.Python | ||
env/ | ||
build/ | ||
develop-eggs/ | ||
dist/ | ||
downloads/ | ||
eggs/ | ||
lib/ | ||
lib64/ | ||
parts/ | ||
sdist/ | ||
var/ | ||
*.egg-info/ | ||
.installed.cfg | ||
*.egg | ||
|
||
# PyInstaller | ||
# Usually these files are written by a python script from a template | ||
# before PyInstaller builds the exe, so as to inject date/other infos into it. | ||
*.manifest | ||
*.spec | ||
|
||
# Installer logs | ||
pip-log.txt | ||
pip-delete-this-directory.txt | ||
|
||
# Unit test / coverage reports | ||
htmlcov/ | ||
.tox/ | ||
.coverage | ||
.cache | ||
nosetests.xml | ||
coverage.xml | ||
|
||
# Translations | ||
*.mo | ||
*.pot | ||
|
||
# Django stuff: | ||
*.log | ||
|
||
# Sphinx documentation | ||
docs/_build/ | ||
|
||
# PyBuilder | ||
target/ | ||
|
||
# Virtual environment | ||
.env/ | ||
.venv/ | ||
venv/ | ||
|
||
# IDEs | ||
.idea | ||
.vscode | ||
|
||
# Python mode for VIM | ||
.ropeproject | ||
**/.ropeproject | ||
|
||
# Vim swap files | ||
*.swp | ||
**/*.swp |
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 |
---|---|---|
|
@@ -2,6 +2,7 @@ | |
data | ||
figures | ||
plots | ||
images | ||
|
||
# IDEs | ||
.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,22 @@ | ||
# Build image with multi-stage builds | ||
# Ensures image is built faster and smaller | ||
FROM python:3.8-slim AS compile-image | ||
RUN apt-get update | ||
RUN apt-get install -y --no-install-recommends build-essential gcc | ||
|
||
# Install with pip‘s --user option, so all files will be installed in | ||
# the .local directory of the current user’s home directory | ||
COPY . /ColonyScanalyser | ||
WORKDIR /ColonyScanalyser | ||
RUN pip install --user . | ||
|
||
# Copy compiled artefacts to fresh image, without compiler baggage | ||
FROM python:3.8-slim AS build-image | ||
COPY --from=compile-image /root/.local /root/.local | ||
|
||
# Make sure scripts in .local are usable: | ||
ENV PATH=/root/.local/bin:$PATH | ||
|
||
# Return help if no arguments are passed to ColonyScanalyser | ||
ENTRYPOINT ["colonyscanalyser"] | ||
CMD ["-h"] |
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
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
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
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,2 @@ | ||
# Create a containerised image of ColonyScanalyser | ||
docker build --pull --rm -f "./Dockerfile" -t colonyscanalyser:latest "." |
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 @@ | ||
# Use a containerised instance of ColonyScanalyser to analyse | ||
# a directory of images in the host system | ||
# | ||
# Pass the directory path to this script, followed by any | ||
# other command line arguments for ColonyScanalyser | ||
# The directory path must be absolute, not relative | ||
# | ||
# Example: | ||
# docker-run.sh /path/to/images/ --verbose 5 --plate_size 100 | ||
|
||
# Store images directory and mount in docker image | ||
# Shift remaining arguments and pass to ColonyScanalyser | ||
img_dir="$1" | ||
shift | ||
# Run ColonyScanalyser on the images in the mounted directory | ||
docker run \ | ||
--rm \ | ||
--name colonyscanalyser \ | ||
--mount type=bind,source=$img_dir,target=/data \ | ||
colonyscanalyser /data \ | ||
$@ |
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