Skip to content

Commit

Permalink
docker: add Dockerfile which runs starfish by default (#297)
Browse files Browse the repository at this point in the history
* docker: add Dockerfile which runs the tests by default

* Change entrypoint to starfish with explanations

* Activate docker in travis
  • Loading branch information
joshmoore authored and ttung committed Jul 5, 2018
1 parent 8546783 commit fc5398b
Show file tree
Hide file tree
Showing 2 changed files with 57 additions and 0 deletions.
4 changes: 4 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,11 +1,15 @@
language: python
sudo: required
services:
- docker
python:
- 3.6
dist: trusty
install:
- pip install -r REQUIREMENTS-DEV.txt -r REQUIREMENTS-NOTEBOOK.txt
- pip install -e .
- pip freeze
- docker build -t spacetx/starfish .
script:
- export MPLBACKEND=Agg
- export BRANCH=$(if [ "$TRAVIS_PULL_REQUEST" == "false" ]; then echo $TRAVIS_BRANCH; else echo $TRAVIS_PULL_REQUEST_BRANCH; fi)
Expand Down
53 changes: 53 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
## Dockerfile for starfish
##
## Default entrypoint is the starfish script,
## but can also be used to run pytests.
##
## Examples:
## --------
##
## (1) Pull the centrally built image
## $ docker pull spacetx/starfish:latest
##
## or, (2) build a local image named "spacetx/starfish"
## $ docker build -t spacetx/starfish .
##
## (3) See the help for starfish
## $ docker run --rm spacetx/starfish -h
##
## (4) Run starfish passing arguments
## $ docker run --rm spacetx/starfish [arguments]
##
## (5) Start bash in the source code directory
## Useful for development.
## $ docker run --rm -it --entrypoint=bash spacetx/starfish
##
## (6) Run the tests on the starfish code base
## $ docker run --rm -it --entrypoint=pytest spacetx/starfish
##
## (7) Print the help for pytests
## $ docker run --rm -it --entrypoint=pytest spacetx/starfish -h
##
## (8) Run TestWithIssData which downloads test data. The
## TEST_ISS_KEEP_DATA flag doesn't delete the data so that the
## data can be extracted from the container with `docker cp`.
## Since no --rm is passed, the container will need to be
## cleaned up later.
##
## $ docker run -e TEST_ISS_KEEP_DATA=true --entrypoint=pytest spacetx/starfish -vsxk TestWithIssData
##
FROM python:3.6

COPY REQUIREMENTS.txt /src/
COPY REQUIREMENTS-DEV.txt /src/
COPY REQUIREMENTS-NOTEBOOK.txt /src/
RUN pip install -r /src/REQUIREMENTS-DEV.txt -r /src/REQUIREMENTS-NOTEBOOK.txt

RUN useradd -m starfish
COPY . /src
RUN chown -R starfish:starfish /src
USER starfish
WORKDIR /src
RUN pip install --user -e .
ENV PATH=${PATH}:/home/starfish/.local/bin
ENTRYPOINT ["starfish"]

0 comments on commit fc5398b

Please sign in to comment.