Gitlab-ci, unable to build docker with docker-compose and git context
Summary
I use Gitlab-ci with shared runner to test and build Caddy. I use Caddy Docker with build-args (https://github.com/abiosoft/caddy-docker)
My Gitlab-CI
image: docker:latest
services:
- docker:dind
before_script:
- apk add --update python py-pip python-dev git openssh-client && pip install docker-compose
stages:
- test
job_test:
stage: test
script:
- docker-compose build caddy
My Docker-compose file
version: '3.4'
services:
# ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~
caddy:
build:
args:
- plugins=jwt,login
context: github.com/abiosoft/caddy-docker.git
ports:
- "443:443"
Pipeline give me a error
$ docker-compose build caddy
Building caddy
failed to init repo at /var/lib/docker/tmp/docker-build-git507789491: : exec: "git": executable file not found in $PATH
ERROR: Job failed: exit code 1
If i use docker and not docker-compose
docker build --build-arg \
plugins=jwt,login \
github.com/abiosoft/caddy-docker.git
No problem
Sending build context to Docker daemon 88.58kB
Step 1/22 : FROM abiosoft/caddy:builder as builder
builder: Pulling from abiosoft/caddy
ff3a5c916c92: Pulling fs layer
I don't have any errors on my PC with docker-compose
Steps to reproduce
On Pipeline
image: docker:latest
services:
- docker:dind
before_script:
- apk add --update python py-pip python-dev git openssh-client && pip install docker-compose
stages:
- test
job_test:
stage: test
script:
- docker-compose build caddy
Actual behavior
$ docker-compose build caddy
Building caddy
failed to init repo at /var/lib/docker/tmp/docker-build-git507789491: : exec: "git": executable file not found in $PATH
ERROR: Job failed: exit code 1