Error when trying to copy folder with absolute path COPY /src/www/ /usr/share/nginx/html/
in Dockerfile
Step 3/4 : COPY /src/www/ /usr/share/nginx/html/ COPY failed: stat /var/lib/docker/tmp/docker-builder685852786/src/www: no such file or directory
Error when trying to copy folder with relative path COPY ../../../src/www/ /usr/share/nginx/html/
in Dockerfile
Step 3/4 : COPY ../../../src/www/ /usr/share/nginx/html/ COPY failed: Forbidden path outside the build context: ../../../src/www/ () ERROR: Job failed: exit code 1
My folders are like this:
------docker-compose.yml
|_____.gitlab-ci.yml
L_______infrastructure
| L_____docker
| L______nginx
| L____Dockerfile
L______src
L____www
I'm running Dockerfile directly from .gitlab-ci.yml with docker build --pull -t "$CI_REGISTRY_IMAGE" ./infrastructure/docker/nginx/.
Dockerfile is:
FROM nginx:stable
MAINTAINER Salle MPWAR Maintainers
COPY /src/www/ /usr/share/nginx/html/
// or COPY ../../../src/www/ /usr/share/nginx/html/ I tried both
I'm missing something with the routes can't make it work with absolute or relative paths.
So as it's explained in this question, I changed the .gitlab-ci.yml command with docker build --pull -t "$CI_REGISTRY_IMAGE" -f ./infrastructure/docker/nginx/Dockerfile .
And the Dockerfile COPY command with COPY ./src/www/ /usr/share/nginx/html/
But it didn't solve my question, as now I have the error:
Step 3/3 : COPY ../../../src/www /usr/share/nginx/html COPY failed: Forbidden path outside the build context: ../../../src/www () ERROR: Job failed: exit code 1