docker args

This commit is contained in:
Alicja Szulecka 2024-04-02 13:47:56 +02:00
parent 1ba161a6b4
commit 6419ff3dc9
2 changed files with 23 additions and 19 deletions

View File

@ -1,7 +1,8 @@
FROM ubuntu:latest
ENV KAGGLE_USERNAME=alicjaszulecka
ENV KAGGLE_KEY=default_key
# Dockerfile
ARG KAGGLE_USERNAME
ARG KAGGLE_KEY
RUN apt update && apt install -y python3-pip
RUN apt install unzip

15
Jenkinsfile vendored
View File

@ -1,6 +1,8 @@
pipeline {
agent {
dockerfile true
dockerfile {
args '-v /var/run/docker.sock:/var/run/docker.sock'
}
}
parameters {
string(name: 'KAGGLE_USERNAME', defaultValue: 'alicjaszulecka', description: 'Kaggle username')
@ -15,13 +17,14 @@ pipeline {
}
stage('Build') {
steps {
withEnv(["KAGGLE_USERNAME=${params.KAGGLE_USERNAME}",
"KAGGLE_KEY=${params.KAGGLE_KEY}" ]) {
sh 'bash ./get_dataset.sh $CUTOFF'
script {
def customImage = docker.build("my-custom-image:${BUILD_NUMBER}", "--build-arg KAGGLE_USERNAME=${params.KAGGLE_USERNAME} --build-arg KAGGLE_KEY=${params.KAGGLE_KEY} .")
customImage.inside {
sh 'bash ./get_dataset.sh ${params.CUTOFF}'
}
}
archiveArtifacts artifacts: 'artifacts/*', onlyIfSuccessful: true
}
}
}
}
}