简体   繁体   中英

Docker Compose build context from git repository with Dockerfile inside folder

I would like to build a new image in my docker compose project using a git repository as I need to change some ARG vars.

My concern is that the Dockerfile is inside a folder of the git repository.

How can be specified a folder as build context using a git repository?

Repository: https://github.com/wodby/drupal-php/blob/master/7/Dockerfile

version: "2"
services:
  php:
    build:
      context: https://github.com/wodby/drupal-php.git
      dockerfile: 7/Dockerfile
      args:
         - BASE_IMAGE_TAG=7.1
         - WODBY_USER_ID=117
         - WODBY_GROUP_ID=111
      volumes:
          - ./:/var/www/html

I've tried the dockerfile property: "FOLDER/" + Dockerfile

But the repository uses relative paths, and it doesn't find dependencies:

 ---> 6cc2006e9102
Step 7/9 : COPY templates /etc/gotpl/
ERROR: Service 'phpe' failed to build: COPY failed: stat /var/lib/docker/tmp/docker-builder740707850/templates: no such file or directory

It should be this way: myrepo.git#:myfolder

version: "2"
services:
  php:
    build:
      context: https://github.com/wodby/drupal-php.git#:7
      args:
         - BASE_IMAGE_TAG=7.1
         - WODBY_USER_ID=117
         - WODBY_GROUP_ID=111
      volumes:
          - ./:/var/www/html

https://docs.docker.com/engine/reference/commandline/build/#git-repositories

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM