cic ussd refactor
This commit is contained in:
parent
1bfc736513
commit
319e587f29
@ -14,10 +14,10 @@ build-mr-cic-cache:
|
|||||||
- apps/cic-cache/**/*
|
- apps/cic-cache/**/*
|
||||||
when: always
|
when: always
|
||||||
|
|
||||||
test-mr-cic-eth:
|
test-mr-cic-cache:
|
||||||
stage: test
|
stage: test
|
||||||
extends:
|
extends:
|
||||||
- .cic_eth_variables
|
- .cic_cache_variables
|
||||||
cache:
|
cache:
|
||||||
key:
|
key:
|
||||||
files:
|
files:
|
||||||
@ -32,7 +32,7 @@ test-mr-cic-eth:
|
|||||||
--extra-index-url https://gitlab.com/api/v4/projects/27624814/packages/pypi/simple
|
--extra-index-url https://gitlab.com/api/v4/projects/27624814/packages/pypi/simple
|
||||||
-r test_requirements.txt
|
-r test_requirements.txt
|
||||||
- export PYTHONPATH=. && pytest -x --cov=cic_cache --cov-fail-under=90 --cov-report term-missing tests
|
- export PYTHONPATH=. && pytest -x --cov=cic_cache --cov-fail-under=90 --cov-report term-missing tests
|
||||||
needs: ["build-mr-cic-eth"]
|
needs: ["build-mr-cic-cache"]
|
||||||
rules:
|
rules:
|
||||||
- if: $CI_PIPELINE_SOURCE == "merge_request_event"
|
- if: $CI_PIPELINE_SOURCE == "merge_request_event"
|
||||||
changes:
|
changes:
|
||||||
|
4
apps/cic-ussd/.dockerignore
Normal file
4
apps/cic-ussd/.dockerignore
Normal file
@ -0,0 +1,4 @@
|
|||||||
|
.git
|
||||||
|
.cache
|
||||||
|
.dot
|
||||||
|
**/doc
|
@ -1,8 +1,8 @@
|
|||||||
.cic_ussd_variables:
|
.cic_ussd_variables:
|
||||||
variables:
|
variables:
|
||||||
APP_NAME: cic-ussd
|
APP_NAME: cic-ussd
|
||||||
DOCKERFILE_PATH: $APP_NAME/docker/Dockerfile
|
DOCKERFILE_PATH: docker/Dockerfile
|
||||||
CONTEXT: apps/
|
CONTEXT: apps/$APP_NAME
|
||||||
|
|
||||||
build-mr-cic-ussd:
|
build-mr-cic-ussd:
|
||||||
extends:
|
extends:
|
||||||
@ -14,6 +14,31 @@ build-mr-cic-ussd:
|
|||||||
- apps/cic-ussd/**/*
|
- apps/cic-ussd/**/*
|
||||||
when: always
|
when: always
|
||||||
|
|
||||||
|
test-mr-cic-ussd:
|
||||||
|
stage: test
|
||||||
|
extends:
|
||||||
|
- .cic_ussd_variables
|
||||||
|
cache:
|
||||||
|
key:
|
||||||
|
files:
|
||||||
|
- test_requirements.txt
|
||||||
|
paths:
|
||||||
|
- /root/.cache/pip
|
||||||
|
image: $MR_IMAGE_TAG
|
||||||
|
script:
|
||||||
|
- cd apps/$APP_NAME/
|
||||||
|
- >
|
||||||
|
pip install --extra-index-url https://pip.grassrootseconomics.net:8433
|
||||||
|
--extra-index-url https://gitlab.com/api/v4/projects/27624814/packages/pypi/simple
|
||||||
|
-r test_requirements.txt
|
||||||
|
- export PYTHONPATH=. && pytest -x --cov=cic_eth --cov-fail-under=90 --cov-report term-missing tests
|
||||||
|
needs: ["build-mr-cic-ussd"]
|
||||||
|
rules:
|
||||||
|
- if: $CI_PIPELINE_SOURCE == "merge_request_event"
|
||||||
|
changes:
|
||||||
|
- apps/cic-eth/**/*
|
||||||
|
when: always
|
||||||
|
|
||||||
build-push-cic-ussd:
|
build-push-cic-ussd:
|
||||||
extends:
|
extends:
|
||||||
- .py_build_push
|
- .py_build_push
|
||||||
|
@ -1,14 +1,6 @@
|
|||||||
# FROM python:3.8.5-alpine
|
# syntax = docker/dockerfile:1.2
|
||||||
FROM python:3.8.6-slim-buster
|
FROM registry.gitlab.com/grassrootseconomics/cic-base-images:python-3.8.6-dev-55da5f4e as dev
|
||||||
|
|
||||||
# set working directory
|
|
||||||
WORKDIR /usr/src
|
|
||||||
|
|
||||||
# add args for installing from self-hosted packages
|
|
||||||
ARG pip_extra_index_url_flag='--extra-index-url https://pip.grassrootseconomics.net:8433'
|
|
||||||
|
|
||||||
RUN apt-get update && \
|
|
||||||
apt install -y gcc gnupg libpq-dev wget make g++ gnupg bash procps git
|
|
||||||
|
|
||||||
# create secrets directory
|
# create secrets directory
|
||||||
RUN mkdir -vp pgp/keys
|
RUN mkdir -vp pgp/keys
|
||||||
@ -17,39 +9,23 @@ RUN mkdir -vp pgp/keys
|
|||||||
RUN mkdir -vp cic-ussd
|
RUN mkdir -vp cic-ussd
|
||||||
RUN mkdir -vp data
|
RUN mkdir -vp data
|
||||||
|
|
||||||
COPY cic-ussd/setup.cfg \
|
COPY requirements.txt .
|
||||||
cic-ussd/setup.py \
|
|
||||||
cic-ussd/
|
|
||||||
|
|
||||||
COPY cic-ussd/requirements.txt \
|
RUN --mount=type=cache,mode=0755,target=/root/.cache/pip \
|
||||||
cic-ussd/test_requirements.txt \
|
pip install --index-url https://pypi.org/simple \
|
||||||
cic-ussd/
|
--extra-index-url $GITLAB_PYTHON_REGISTRY --extra-index-url $EXTRA_INDEX_URL \
|
||||||
|
-r requirements.txt
|
||||||
|
|
||||||
# install requirements
|
COPY . .
|
||||||
RUN cd cic-ussd && \
|
RUN python setup.py install
|
||||||
pip install -r requirements.txt $pip_extra_index_url_flag
|
|
||||||
|
|
||||||
# copy all necessary files
|
COPY cic_ussd/db/ussd_menu.json data/
|
||||||
COPY cic-ussd/cic_ussd/ cic-ussd/cic_ussd/
|
|
||||||
COPY cic-ussd/cic_ussd/db/ussd_menu.json data/
|
|
||||||
COPY cic-ussd/scripts/ cic-ussd/scripts/
|
|
||||||
COPY cic-ussd/states/ cic-ussd/states/
|
|
||||||
COPY cic-ussd/transitions/ cic-ussd/transitions/
|
|
||||||
COPY cic-ussd/var/ cic-ussd/var/
|
|
||||||
|
|
||||||
COPY cic-ussd/docker/db.sh \
|
|
||||||
cic-ussd/docker/start_cic_user_tasker.sh \
|
|
||||||
cic-ussd/docker/start_cic_user_ussd_server.sh\
|
|
||||||
cic-ussd/docker/start_cic_user_server.sh\
|
|
||||||
/root/
|
|
||||||
|
|
||||||
|
COPY docker/*.sh .
|
||||||
RUN chmod +x /root/*.sh
|
RUN chmod +x /root/*.sh
|
||||||
RUN cd cic-ussd && \
|
|
||||||
pip install $pip_extra_index_url_flag .
|
|
||||||
|
|
||||||
|
|
||||||
# copy config and migration files to definitive file so they can be referenced in path definitions for running scripts
|
# copy config and migration files to definitive file so they can be referenced in path definitions for running scripts
|
||||||
COPY cic-ussd/.config/ /usr/local/etc/cic-ussd/
|
COPY .config/ /usr/local/etc/cic-ussd/
|
||||||
COPY cic-ussd/cic_ussd/db/migrations/ /usr/local/share/cic-ussd/alembic
|
COPY cic_ussd/db/migrations/ /usr/local/share/cic-ussd/alembic
|
||||||
|
|
||||||
WORKDIR /root
|
ENTRYPOINT []
|
||||||
|
@ -464,8 +464,8 @@ services:
|
|||||||
|
|
||||||
cic-user-ussd-server:
|
cic-user-ussd-server:
|
||||||
build:
|
build:
|
||||||
context: apps/
|
context: apps/cic-ussd
|
||||||
dockerfile: cic-ussd/docker/Dockerfile
|
dockerfile: docker/Dockerfile
|
||||||
environment:
|
environment:
|
||||||
DATABASE_USER: grassroots
|
DATABASE_USER: grassroots
|
||||||
DATABASE_HOST: postgres
|
DATABASE_HOST: postgres
|
||||||
@ -493,8 +493,8 @@ services:
|
|||||||
|
|
||||||
cic-user-server:
|
cic-user-server:
|
||||||
build:
|
build:
|
||||||
context: apps
|
context: apps/cic-ussd
|
||||||
dockerfile: cic-ussd/docker/Dockerfile
|
dockerfile: docker/Dockerfile
|
||||||
environment:
|
environment:
|
||||||
DATABASE_USER: grassroots
|
DATABASE_USER: grassroots
|
||||||
DATABASE_HOST: postgres
|
DATABASE_HOST: postgres
|
||||||
@ -515,8 +515,8 @@ services:
|
|||||||
|
|
||||||
cic-user-tasker:
|
cic-user-tasker:
|
||||||
build:
|
build:
|
||||||
context: apps
|
context: apps/cic-ussd/
|
||||||
dockerfile: cic-ussd/docker/Dockerfile
|
dockerfile: docker/Dockerfile
|
||||||
environment:
|
environment:
|
||||||
DATABASE_USER: grassroots
|
DATABASE_USER: grassroots
|
||||||
DATABASE_HOST: postgres
|
DATABASE_HOST: postgres
|
||||||
|
Loading…
Reference in New Issue
Block a user