common-workflow-language / cwltool

Common Workflow Language reference implementation
https://cwltool.readthedocs.io/
Apache License 2.0
332 stars 230 forks source link

dockerFile #26

Open portah opened 8 years ago

portah commented 8 years ago

How to use dockerFile, As I understand it works with dockerImageId, both of them has to be specified!

It would be nice to try it in some order?

requirements:
  - "@import": envvar-global.cwl
  - class: InlineJavascriptRequirement
  - class: DockerRequirement
    dockerImageId: scidap/star:v2.5.0a
    dockerPull: scidap/star:v2.5.0a
    dockerFile: |
      #################################################################
      # Dockerfile
      #
      # Software:         STAR
      # Software Version: 2.5.0a
      # Description:      STAR image for SciDAP
      # Website:          https://github.com/alexdobin/STAR, http://scidap.com/
      # Provides:         STAR
      # Base Image:       scidap/scidap:v0.0.1
      # Build Cmd:        docker build --rm -t scidap/star:v2.5.0a .
      # Pull Cmd:         docker pull scidap/star:v2.5.0a
      # Run Cmd:          docker run --rm scidap/star:v2.5.0a STAR
      #################################################################

      ### Base Image
      FROM scidap/scidap:v0.0.1
      MAINTAINER Andrey V Kartashov "porter@porter.st"
      ENV DEBIAN_FRONTEND noninteractive

      ################## BEGIN INSTALLATION ######################

      WORKDIR /tmp

      ### Install STAR

      ENV VERSION 2.5.0a
      ENV NAME STAR
      ENV URL "https://github.com/alexdobin/STAR/archive/${NAME}_${VERSION}.tar.gz"

      RUN wget -q -O - $URL | tar -zxv && \
      cd ${NAME}-${NAME}_${VERSION}/source && \
      make -j 4 && \
      cd .. && \
      cp ./bin/Linux_x86_64_static/STAR /usr/local/bin/ && \
      cd .. && \
      strip /usr/local/bin/${NAME}; true && \
      rm -rf ./${NAME}-${NAME}_${VERSION}/
/usr/local/bin/cwltool 1.0.20151126171959
Got workflow error
Traceback (most recent call last):
  File "build/bdist.macosx-10.11-intel/egg/cwltool/main.py", line 159, in single_job_executor
    r.run(**kwargs)
  File "build/bdist.macosx-10.11-intel/egg/cwltool/job.py", line 56, in run
    img_id = docker.get_from_requirements(docker_req, docker_is_req, pull_image)
  File "build/bdist.macosx-10.11-intel/egg/cwltool/docker.py", line 95, in get_from_requirements
    if get_image(r, pull_image, dry_run):
  File "build/bdist.macosx-10.11-intel/egg/cwltool/docker.py", line 21, in get_image
    sp = dockerRequirement["dockerImageId"].split(":")
KeyError: 'dockerImageId'
Workflow error:
  'dockerImageId'
manu-chroma commented 7 years ago

Hey @portah, it's been a very long time but can you confirm if you're still facing this problem? :sweat_smile:

manu-chroma commented 7 years ago

cwlVersion is not specified in the workflow. I added cwlversion: v1.0 and tried running to get the following errror:

(venv) [venv] ~/github/test_cwl_runner $ cwl-runner test.cwl                                                  21:57:14
/home/manu/github/cwltool/venv/bin/cwl-runner 1.0.20170812174804
Resolved 'test.cwl' to 'file:///home/manu/github/test_cwl_runner/test.cwl'
Tool definition failed validation:
test.cwl:1:1: Object `test.cwl` is not valid because
                - tried `CommandLineTool` but
                    Missing 'class' field
                - tried `ExpressionTool` but
                    Missing 'class' field
                - tried `Workflow` but
                    Missing 'class' field