Common repository and different Dockerfile and docker-compose.yml

22 views Asked by At

I try do use a common directory for build my images

Certif
    abc.crt
    def.crt
Image_1
    docker-compose.yml
    backend
        index_1.html
    Dockerfile.1
Image_2
    docker-compose.yml
    backend
        index_2.html
    Dockerfile.2
Image_3
    docker-compose.yml
    backend
        index_3.html
    Dockerfile.3

My Dockerfile are like that

FROM ubuntu
COPY ../Certif/* /usr/local/share/ca-certificates/
WORKDIR /

And my docker-compose.yml like that

version: "3.3"
services:
  Image_1_serv:
    build:
      context: ./
      dockerfile: ./Dockerfile.1
    image: Image_1

And when I run docker-compose build in Image_1 I got this error

Step 2/3 : COPY ../Certif/* /usr/local/share/ca-certificates/
COPY failed: no source files were specified
ERROR: Service 'Image_1_serv' failed to build : Build failed

Is this the right way to have files common to all images and if so why do I get this error? Should I put the full path? From what I understand from the documentation I cannot access the parent file where my docker-compose is located

0

There are 0 answers