diff --git a/.docker-compose/Dockerfile b/.docker-compose/Dockerfile deleted file mode 100644 index 224b14f..0000000 --- a/.docker-compose/Dockerfile +++ /dev/null @@ -1,25 +0,0 @@ -FROM python:3.9.6 - -RUN apt-get update -RUN apt-get -y install coinor-cbc -RUN python -m pip install pulp -RUN python -m pip install pydantic -RUN python -m pip install daemonize -RUN python -m pip install sqspy -RUN python -m pip install -U pytest -RUN python -m pip install pytest-cov -RUN python -m pip install pytest-stub -RUN python -m pip install pytest-mock -RUN python -m pip install girth --upgrade - -RUN mkdir /app -WORKDIR /app - -ENV LOCAL_DEV True - -# Bundle app source -COPY . /app - -WORKDIR /app/app - -CMD [ "python", "main.py" ] diff --git a/.vagrantrc b/.vagrantrc deleted file mode 100644 index ddc7b4d..0000000 --- a/.vagrantrc +++ /dev/null @@ -1,48 +0,0 @@ -#!/usr/bin/env bash - -. $MEASURE_SRC_PATH/.vagrantrc - -[ ! -f docker-compose.override.yml ] && cat < docker-compose.override.yml -override_file_placeholder: - image: busybox -YAML - -measure-vagrant-id() { - vagrant global-status | grep 'yardstick\s*$' | awk '{ print $1 }' -} - -vagrant-shell() { - vagrant ssh `measure-vagrant-id` -} - -vagrant-ssh() { - vagrant ssh `measure-vagrant-id` -c "$*" -} - -compose() { - vagrant-ssh "cd /apps/measure-solver && \\ - docker-compose -f '/app/docker-compose.yml' \\ - -f '/apps/measure-solver/docker-compose.yml' \\ - -f '/apps/measure-solver/docker-compose.override.yml' \\ - $*" -} - -run() { - compose "run --rm measure-solver $*" -} - -run-script() { - run "rails $*" -} - -measure-solver-logs() { - compose "logs measure-solver" -} - -restart-measure-solver() { - compose "restart measure-solver" -} - -rails() { - run-script "$*" -} diff --git a/Dockerfile b/Dockerfile index cb104f2..9ae35da 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,23 +1,26 @@ -FROM python:3.9.6 +FROM python:3.9.6 AS base +LABEL maintainer='Meazure Developers ' RUN apt-get update RUN apt-get -y install coinor-cbc -RUN python -m pip install pulp -RUN python -m pip install pydantic -RUN python -m pip install daemonize -RUN python -m pip install sqspy -RUN python -m pip install -U pytest -RUN python -m pip install pytest-cov -RUN python -m pip install pytest-stub -RUN python -m pip install pytest-mock -RUN python -m pip install girth --upgrade + +ARG PIP_INDEX_URL +ARG PIP_INDEX + +ENV PIP_INDEX_URL $PIP_INDEX_URL +ENV PIP_INDEX $PIP_INDEX +ENV PIP_TARGET /pip +ENV PYTHONPATH /pip RUN mkdir /app WORKDIR /app -# Bundle app source +CMD [ "python", "app/main.py" ] + +FROM base AS development + +FROM base + COPY . /app -WORKDIR /app/app - -CMD [ "python", "main.py" ] +RUN python -m pip install -r requirements.txt diff --git a/Jenkinsfile b/Jenkinsfile index 307591b..7bf2664 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -11,8 +11,18 @@ pipeline { stages { stage('Build Kaniko image') { steps { - withCredentials([usernamePassword(credentialsId: 'DockerHubAccessYardstick', usernameVariable: 'USER', passwordVariable: 'PASS')]) { - container('kaniko') { + withVault([ vaultSecrets: [ + [ + path: "ci/general", + engineVersion: 1, + secretValues: [ + [envVar: 'PIP_USER', vaultKey: 'SONATYPE_READONLY_USER'], + [envVar: 'PIP_PASSWORD', vaultKey: 'SONATYPE_READONLY_USER_PASSCODE'] + ] + ] + ]]) { + withCredentials([usernamePassword(credentialsId: 'DockerHubAccessYardstick', usernameVariable: 'USER', passwordVariable: 'PASS')]) { + container('kaniko') { checkout scm // Setup docker credentials sh 'echo "{\\"auths\\":{\\"https://index.docker.io/v1/\\":{\\"auth\\":\\"$(printf "%s:%s" "$USER" "$PASS" | base64 | tr -d \'\n\')\\"}}}" > /kaniko/.docker/config.json' @@ -23,13 +33,16 @@ pipeline { --insecure=true \ --insecure-registry=docker-registry.default:5000 \ --cache=true \ + --build-arg PIP_INDEX_URL=https://${PIP_USER}:${PIP_PASSWORD}@artifact.it.getyardstick.com/repository/meazurelearning-pypi/simple \ + --build-arg PIP_INDEX=https://${PIP_USER}:${PIP_PASSWORD}@artifact.it.getyardstick.com/repository/meazurelearning-pypi/pypi \ --cache-repo=docker-registry.default:5000/${REPOSITORY} \ --destination ${env.REPOSITORY}:\$(echo ${BRANCH_NAME} | grep -Eo 'feature/([A-Za-z]+-[0-9]*)' | grep -Eo '[A-Za-z]+-[0-9]*' || \ echo ${BRANCH_NAME} | grep -Eo '(release|hotfix)/[[:digit:]]+\\.[[:digit:]]+\\.[[:digit:]]+' | grep -Eo '[[:digit:]]+\\.[[:digit:]]+\\.[[:digit:]]+' || \ echo ${BRANCH_NAME} | grep -Eo 'YASDEV-([[:digit:]]*)') """ + } + } } - } } } } diff --git a/app/lib/irt/models/rasch.py b/app/lib/irt/models/rasch.py index 96090b5..624e472 100644 --- a/app/lib/irt/models/rasch.py +++ b/app/lib/irt/models/rasch.py @@ -1,4 +1,4 @@ -from girth import ability_mle +from mirth import ability_mle from lib.irt.models.base import * diff --git a/rc b/rc deleted file mode 100644 index f4b4dd2..0000000 --- a/rc +++ /dev/null @@ -1,9 +0,0 @@ -#!/usr/bin/env bash - -export MEASURE_SRC_PATH=../yardstick - -if [ -f .user_rc ]; then - . .user_rc -fi - -source .vagrantrc diff --git a/requirements.txt b/requirements.txt new file mode 100644 index 0000000..8803345 --- /dev/null +++ b/requirements.txt @@ -0,0 +1,9 @@ +daemonize==2.5.0 +mirth==0.10.3 +PuLP==2.7.0 +pydantic==2.4.2 +pytest==7.4.2 +pytest-cov==4.1.0 +pytest-mock==3.11.1 +pytest-stub==1.1.0 +sqspy==1.0.0