1

If my project structure is like this:

├── compose
│   ├── local
│   │   └── django
│   │       ├── Dockerfile
│   │       ├── celery
│   │       │   ├── beat
│   │       │   │   └── start.sh
│   │       │   └── worker
│   │       │       └── start.sh
│   │       └── start.sh
│   └── production
│       ├── caddy
│       │   ├── Caddyfile
│       │   └── Dockerfile.caddy
│       ├── django
│       │   ├── Dockerfile.django  

I am calling from root, $  heroku container:push --recursive

However, build will fail citing COPY fail:

Sending build context to Docker daemon  3.072kB
Step 1/2 : FROM abiosoft/caddy:0.10.6
 ---> d8ff070e1cee
Step 2/2 : COPY ./compose/production/caddy/Caddyfile /etc/Caddyfile
COPY failed: stat /var/lib/docker/tmp/docker-builder022230374/compose/production/caddy/Caddyfile: no such file or directory
 ▸    Error: docker build exited with 1  

The actual Dockerfile:

FROM abiosoft/caddy:0.10.6

COPY ./compose/production/caddy/Caddyfile /etc/Caddyfile

I have read this similar stackoverflow post: Dockerfile COPY instruction failing?

Per the top answer, I did believe I'm referencing the file explicitly at build.
I guess not. What am I missing?

Jay Jung
  • 1,805
  • 3
  • 23
  • 46
  • If your Dockerfile is located at the project root, `COPY . /etc/Caddyfile` can be used since the first argument of `COPY` is relative path (If not, the relative path can be supplied instead of `.` here). See: https://docs.docker.com/engine/reference/builder/#copy – vahdet Mar 21 '18 at 12:42
  • Do you have any `.dockerignore` file in your project? – Yuankun Mar 21 '18 at 13:55
  • @Yuankun yeah, but I don't think it references any relevant files: `.* !.coveragerc !.env !.pylintrc` – Jay Jung Mar 21 '18 at 13:59
  • 1
    Doesn't `.*` mean ignoring everything? – Yuankun Mar 21 '18 at 14:04
  • Actually, that's not it.. the dot isn't in reference to any file, only a file path within a non-ignored file.. – Jay Jung Mar 21 '18 at 14:25
  • Yah you're right, sorry about my mistake. – Yuankun Mar 21 '18 at 14:51

0 Answers0