Wercker's internal/docker-build fails with context property

135 views Asked by At

I have a project, where I intend to build and publish more than one Docker images with wercker. The source code for each of these are in their separate folders inside the project.

To serve as a simpler example I have created a repository, where you can reproduce this problem. I used an wercker's internal/docker-build. In the link it is clear there is a context property context, but it doesn't seem to have an effect: the context still seems to be the root of my project.

My folder structure:

  • Root:
    • flask-app
      • app.py
      • requirements.txt
      • Dockerfile
    • wercker.yml

My wercker.yml file:

box:
id: python:2.7-slim
ports:
- "5000"

build:
  steps:
    - internal/docker-build:
        dockerfile: flask-app/Dockerfile
        context: flask-app
        image-name: flask-app

When I run wercker build --pipeline build in the project root, the output:

--> No Docker host specified, checking: /var/run/docker.sock
--> Executing pipeline
--> Copying working directory to: /home/handris/Projects/wercker-context/.wercker/projects/wercker-context
--> Copied working directory: 0.00s
--> Running step: setup environment
Pulling from library/python: 2.7-slim
Digest: sha256:df3ba9998242864e650d62d158685c3c7af8c4f3ae1545bdc38780473b0b6c55
Status: Image is up to date for python:2.7-slim
--> Copying source to container
--> Running step: wercker-init
--> Running step: docker build
Step 1/7 : FROM python:3.6-alpine
Pulling from library/python: 3.6-alpine
Digest: sha256:4ae5142f052c4efd0bede8483f8ca43a73e8fcfce5dbf8f581967c2c9bac597b
Status: Image is up to date for python:3.6-alpine
 ---> 1837080c5e87
Step 2/7 : ENV PYTHONUNBUFFERED=1
 ---> Using cache
 ---> c4a790b9c973
Step 3/7 : WORKDIR /app
 ---> Using cache
 ---> 69ff1c48b2ac
Step 4/7 : COPY requirements.txt requirements.txt
--> Steps passed: 5.60s
--> Pipeline finished: 5.80s

It cannot copy my requirements.txt that is in the same folder as my Dockerfile.

My wercker version:

wercker version 1.0.1216 (Compiled at: 2018-05-01T13:14:48Z, Git commit: 426a99095ec0c95391620319833338afd1ccbc74)

What I am I missing? How can I make the context property work with internal/docker-build?

Edit: I also tried running the build without the dockerfile property, like so:

    - internal/docker-build:
      context: flask-app
      image-name: flask-app

In this case, the output:

--> No Docker host specified, checking: /var/run/docker.sock
--> Executing pipeline
--> Copying working directory to: /home/handris/Projects/wercker-context/.wercker/projects/wercker-context
--> Copied working directory: 0.00s
--> Running step: setup environment
Pulling from library/python: 2.7-slim
Digest: sha256:df3ba9998242864e650d62d158685c3c7af8c4f3ae1545bdc38780473b0b6c55
Status: Image is up to date for python:2.7-slim
--> Copying source to container
--> Running step: wercker-init
--> Running step: docker build
ERROR Failed to build image: Error response from daemon: Cannot locate specified Dockerfile: Dockerfile
--> Error response from daemon: Cannot locate specified Dockerfile: Dockerfile
--> Step failed: docker build Error response from daemon: Cannot locate specified Dockerfile: Dockerfile 0.28s
--> Pipeline failed: 3.40s
FATAL Step failed: docker build

And I have also tried specifying only the dockerfile property, like:

  steps:
    - internal/docker-build:
        dockerfile: flask-app/Dockerfile
        image-name: flask-app

In this case my console output is the same as in the first case.

0

There are 0 answers