Rozwiązania zadań z lab4 (Docker)

This commit is contained in:
Szymon Parafiński 2022-04-24 22:27:33 +02:00
parent e1bceebb15
commit 4860753e13
3 changed files with 82 additions and 0 deletions

26
lab4/Dockerfile Normal file
View File

@ -0,0 +1,26 @@
FROM ubuntu:latest
RUN apt-get update
RUN apt-get install -y python3-pip
RUN apt-get install -y unzip
RUN pip3 install kaggle
RUN pip3 install pandas
RUN pip3 install sklearn
RUN pip3 install numpy
ARG CUTOFF
ARG KAGGLE_USERNAME
ARG KAGGLE_KEY
ENV CUTOFF=${CUTOFF}
ENV KAGGLE_USERNAME=${KAGGLE_USERNAME}
ENV KAGGLE_KEY=${KAGGLE_KEY}
WORKDIR /app
COPY lab2/download.sh .
COPY lab2/main.py .
RUN chmod +x ./download.sh
RUN ./download.sh
RUN python3 ./main.py

32
lab4/Jenkinsfile vendored Normal file
View File

@ -0,0 +1,32 @@
pipeline {
agent {
dockerfile {
additionalBuildArgs "--build-arg KAGGLE_USERNAME=${params.KAGGLE_USERNAME} --build-arg KAGGLE_KEY=${params.KAGGLE_KEY} --build-arg CUTOFF=${params.CUTOFF} -t docker_image"
}
}
parameters {
string(
defaultValue: 'szymonparafinski',
description: 'Kaggle username',
name: 'KAGGLE_USERNAME',
trim: false
)
password(
defaultValue: '',
description: 'Kaggle token taken from kaggle.json file, as described in https://github.com/Kaggle/kaggle-api#api-credentials',
name: 'KAGGLE_KEY'
)
string(
defaultValue: '100',
description: 'Cutoff lines',
name: 'CUTOFF'
)
}
stages {
stage('Script'){
steps {
archiveArtifacts artifacts: 'data_test.csv, data_train.csv, data_dev.csv', followSymlinks: false
}
}
}
}

24
lab4/Jenkinsfile_stats Normal file
View File

@ -0,0 +1,24 @@
pipeline {
agent {
docker {
image 'docker_image'
}
}
parameters{
buildSelector(
defaultSelector: lastSuccessful(),
name: 'BUILD_SELECTOR',
description: 'Which build to use for copying artifacts'
)
}
stages {
stage("Script") {
steps {
copyArtifacts fingerprintArtifacts: true, projectName: 's444018-create-dataset', selector: buildParameter('BUILD_SELECTOR')
sh 'chmod +x ./lab2/stats.sh'
sh "./lab2/stats.sh"
archiveArtifacts 'stats.txt'
}
}
}
}