I’m trying to get a lemp stack working on docker, and it’s going pretty well. I would like to have my git repo pulled by a container, written to the folder /var/www, so that it can be accessed by my other containers. My docker-compose.yml file looks like this:
version: '3' services: web: image: nginx:1.17 volumes: - "./site.conf:/etc/nginx/conf.d/default.conf" - "./lemp:/var/www" ports: - "8080:80" restart: always depends_on: - php php: build: context: . dockerfile: php.Dockerfile volumes: - "./lemp:/var/www" restart: always depends_on: - git git: build: context: . dockerfile: git.Dockerfile volumes: - "./lemp:/var/www" restart: always
Lemp is just an empty folder for now, sitting in my directory. I’m trying to clone my git repo in the var/www with this Dockerfile:
FROM alpine/git:1.0.4 COPY github_key . CMD eval $(ssh-agent) && \ ssh-add github_key && \ ssh-keyscan -H github.com >> /etc/ssh/ssh_known_hosts && \ git -C /var/www clone email@example.com:assisty/assistyou-api.git
So I would expect my repo to be in /var/www/assistyou-api, which contains an index.php file.
However, when I’m running docker-compose up, and I try to access the port 8080 I get a 404 with following message:
web_1 | 2019/12/23 15:49:39 [error] 6#6: *1 "/var/www/assistyou-api/index.php" is not found (2: No such file or directory), client: xx.xx.72.90, server: php-docker.local, request: "GET / HTTP/1.1", host: "xx.xxx.213.240:8080"
Can anyone tell me what I’m doing wrong here? I can not seem to figure it out. Any suggestion on how to do this in another or better way are also welcome. Thanks!