NOTE: This is codefresh running on-prem on version 2.0.17
Hi,
I am trying to use a docker-compose.yml file in the service: composition step like so
service:
composition: <path-to-file>/docker-compose-postgres.yml
However, no matter what I try I get the same error
Message Failed to prepare composition: services
Caused by Failed to read file /codefresh/volume/<path-to-file>/docker-compose-postgres.yml
I have tried setting the working directory, copying the docker-compose to the top level, and changing its access permissions but I keep getting the same error.
I have verified that the folder path and file exist.
Full step
integration_tests:
title: Integration tests
stage: code build & test
image: ${{build image}}
# working_directory: ${{clone}} get the error regardless if I use this
environment:
- ENVIRONMENT_DATASOURCE_POSTGRESHOST=my_postgres
- ENVIRONMENT_RABBITMQ_ADDRESSES=rabbitmq:5672
- ENVIRONMENT_RABBITMQ_PASSWORD=guest
commands:
- ${{mvn_cmd}}
services:
composition: <path-to-file>/docker-compose-postgres.yml
readiness:
timeoutSeconds: 30
periodSeconds: 15
image: <image>
commands:
- "pg_isready -h my_postgres -U postgres"
when:
condition:
all:
integrationTestNotDisabled: '"${{DISABLE_INTEGRATION_TEST}}" != "true"'
developOrReleaseBranch: "match('${{CF_BRANCH}}', '^release\/.*|^develop*|^${{OVERRIDE_BRANCH}}', true)"
Docker
name: integration_tests_postgres
services:
my_postgres:
image: "<postgres-image>"
ports:
- "5432:5432"
environment:
POSTGRES_USER: postgres
POSTGRES_PASSWORD: postgres
volumes:
- '${CF_VOLUME_NAME}:${CF_VOLUME_PATH}'
command:
- sh -c 'ln -s /codefresh/volume/${CF_REPO_NAME}/init.sql /docker-entrypoint-initdb.d/ && /usr/local/bin/docker-entrypoint.sh -c "shared_buffers=256MB" -c "max_connections=200"'
rabbitmq:
image: "<rabbitmq-image>"
environment:
- RABBITMQ_DEFAULT_USER=guest
- RABBITMQ_DEFAULT_PASS=guest
ports:
- "5672:5672"
- "15672:15672"
I have read through Best practices for config reusability? - #5 by Miguel_Medina. However none of the solutions proposed seem to work for me.