gitlab runner (shell executor) results in the following Error: django.db.utils.OperationalError: unable to open database file
.gitlab-ci.yml:
stages:
- test
pytest:
stage: test
image: docker/compose:latest
tags:
- test
before_script:
- docker-compose build
- docker-compose run --rm django python manage.py migrate
- docker-compose up -d
script:
- docker-compose run django python manage.py test
Django Engine settings.py:
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.sqlite3',
'NAME': os.path.join(BASE_DIR, 'db.sqlite3'),
}
}
Here is my Dockerfile. The WORKDIR ist /app
FROM python:3.8-alpine
ENV PATH="/scripts:${PATH}"
COPY ./requirements /requirements
RUN pip install -r /requirements/local.txt -r /requirements/production.txt
RUN apk del .tmp
RUN mkdir /app
COPY ./app /app
WORKDIR /app
COPY ./scripts /scripts
RUN chmod +x /scripts/*
RUN mkdir -p /vol/web/media
RUN mkdir -p /vol/web/static
RUN adduser -D user
RUN chown -R user:user /vol
RUN chown -R user:user /app
RUN chmod -R 755 /vol/web
USER user
CMD ["entrypoint.sh"]
I do not push db.sqlite3 to my gitlab project.