Update Jenkinsfile and Dockerfile

This commit is contained in:
zgolebiewska 2024-05-26 12:42:18 +02:00
parent e8d40ac1cf
commit 7afd9db341
3 changed files with 57 additions and 4 deletions

View File

@ -1,14 +1,19 @@
FROM ubuntu:latest FROM ubuntu:latest
RUN apt-get update && apt-get install -y python3-pip unzip coreutils RUN apt-get update && apt-get install -y \
python3-pip \
unzip \
coreutils
RUN pip install --user kaggle pandas scikit-learn tensorflow RUN pip install --user kaggle pandas scikit-learn tensorflow
WORKDIR /app WORKDIR /app
COPY ./data_processing.sh ./ COPY ./data_processing.sh ./
COPY ./model.py ./
COPY ./OrangeQualityData.csv ./ COPY ./OrangeQualityData.csv ./
COPY ./orange_quality_model_tf.h5 ./ COPY ./requirements.txt ./
COPY ./predictions_tf.json ./
CMD ["python3", "data_processing.sh"] RUN pip install --user -r requirements.txt
CMD ["python3", "model.py"]

45
Jenkinsfile vendored
View File

@ -8,6 +8,16 @@ pipeline {
defaultValue: '10000', defaultValue: '10000',
name: 'CUTOFF', name: 'CUTOFF',
description: 'Liczba wierszy do obcięcia ze zbioru danych') description: 'Liczba wierszy do obcięcia ze zbioru danych')
string(
defaultValue: '',
name: 'TRAINING_PARAMS',
description: 'Parametry trenowania'
)
}
environment {
DATASET_PROJECT = 's123456-create-dataset'
DATA_DIR = 'data'
} }
stages { stages {
@ -16,6 +26,17 @@ pipeline {
checkout([$class: 'GitSCM', branches: [[name: '*/master']], userRemoteConfigs: [[url: 'https://git.wmi.amu.edu.pl/s464906/ium_464906']]]) checkout([$class: 'GitSCM', branches: [[name: '*/master']], userRemoteConfigs: [[url: 'https://git.wmi.amu.edu.pl/s464906/ium_464906']]])
} }
} }
stage('Copy Dataset') {
steps {
script {
copyArtifacts(
projectName: "${DATASET_PROJECT}",
selector: lastSuccessful(),
target: "${env.DATA_DIR}"
)
}
}
}
stage('Set execute permission') { stage('Set execute permission') {
steps { steps {
script { script {
@ -35,5 +56,29 @@ pipeline {
} }
} }
} }
stage('Install Dependencies') {
steps {
sh 'pip install -r requirements.txt'
}
}
stage('Train Model') {
steps {
sh "python model.py ${params.TRAINING_PARAMS}"
}
}
stage('Archive Model') {
steps {
archiveArtifacts artifacts: 'orange_quality_model_tf.h5', allowEmptyArchive: true
archiveArtifacts artifacts: 'predictions_tf.json', allowEmptyArchive: true
}
}
}
post {
always {
cleanWs()
}
} }
} }

3
requirements.txt Normal file
View File

@ -0,0 +1,3 @@
tensorflow
pandas
scikit-learn