I had to change services: docker in GitLab-CI.yml file to services: docker:19.03.5-dind because I was dealing with some compatibility issues but now GitLab-CI runner is having problems with importing enum for Python 2.7 within the container:
Running after script...
00:01
$ docker-compose down
Traceback (most recent call last):
File "/usr/bin/docker-compose", line 7, in <module>
from compose.cli.main import main
File "/usr/lib/python2.7/site-packages/compose/cli/main.py", line 35, in <module>
from ..project import get_image_digests
File "/usr/lib/python2.7/site-packages/compose/project.py", line 11, in <module>
import enum
ImportError: No module named enum
ERROR: Job failed: exit code 1
This is my GitLab-CI.yml file:
image: docker:stable
services:
- docker:19.03.5-dind
stages:
- build
before_script:
- export REACT_APP_USERS_SERVICE_URL=http://127.0.0.1
compile:
stage: build
script:
- apk add --no-cache py-pip python-dev libffi-dev openssl-dev gcc libc-dev make
- pip install docker-compose
- docker-compose up -d --build
- docker-compose exec -T users python manage.py recreate_db
- docker-compose exec -T users python manage.py seed_db
- docker-compose exec -T users python manage.py test
- docker-compose exec -T users flake8 project
after_script:
- docker-compose down
It's quite obvious that Docker is trying to pull Python's enum module to perform certain tasks and fails. What should I do to resolve this ?
Edit:
I've added python3-dev to the build script to make it read like this
- apk add --no-cache py-pip python-dev python3-dev libffi-dev openssl-dev gcc libc-dev make
surprisingly that didn't help either. Same error.