Reputation: 335
Have some way to use copy command with the relative path in dockerfile? I'm trying to use:
COPY ./../folder/*.csproj ./
OBS.: My struct folder (I'm running the dockerfile on project-test and other files are in the project-console folder) is:
|- project-console
|- project-test
And I receive the following error:
ERROR: service 'app' failed to build: COPY failed: no source files were specified.
My purpose is have two projects in the same docker. I have a dotnet core console and another with a unity test (NUnity), I'm trying to run the unity test in docker.
UPDATE
Is possible to use Multi-stage: https://docs.docker.com/develop/develop-images/multistage-build/
Or using docker-compose with build: https://docs.docker.com/engine/reference/commandline/build/
Like:
services:
worker:
build:
context: ./workers
dockerfile: Dockerfile
Upvotes: 11
Views: 22804
Reputation: 1382
Reference: Allow Dockerfile from outside build-context
You can try this way
$ cd project-console
$ docker build -f ../project-test/Dockerfile .
Update:
By using docker-compose
build:
context: ../
dockerfile: project-test/Dockerfile
../
will be set as the context, it should include project-console and project-test in your case. So that you can COPY
project-console/*.csproj in Dockerfile.
Upvotes: 15