I’m trying to create a config that will let me, build my docker image on circleci and run pytests there. However, the command for running tests requires running docker container. In config file are the things I’ve tried.
Build process is stuck on building forever after docker-compose -f docker-compose.yml -f docker-compose.ci.yml -f docker-compose.testing.yml up
command, all the services seem to be running / listening but the build never ends.
I just started using circleCi, I’d greatly appreciate any help, goal is to build my image, run it, run the tests and report whether all passed or not.
version: 2.1
#working_directory: /app docker: - image: docker:17.05.0-ce-git steps: - checkout - setup_remote_docker - run: name: Install dependencies
jobs:
build:
docker:
- image: cimg/base:stable
steps:
- setup_remote_docker:
version: 20.10.7
- checkout
- run:
name: "Build and Run"
command: |
docker-compose build
docker-compose -f docker-compose.yml -f docker-compose.ci.yml -f docker-compose.testing.yml up
docker-compose exec api pytest tests/
# test:
# docker:
# - image: cimg/python:3.9.1
# steps:
# - checkout
# - run:
# name: "Test"
# command: docker-compose exec api pytest tests/
# - store_artifacts:
# path: test-results.xml
# prefix: tests
workflows:
version: 2
build_and_test:
jobs:
- build
# - test:
# requires:
# - build
# filters:
# branches:
# only: circleci-project-setup
general:
branches:
only:
- circleci-project-setup```