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 FROM ubuntu:latest
ENV KAGGLE_USERNAME=alicjaszulecka # Dockerfile
ENV KAGGLE_KEY=default_key ARG KAGGLE_USERNAME
ARG KAGGLE_KEY
RUN apt update && apt install -y python3-pip RUN apt update && apt install -y python3-pip
RUN apt install unzip RUN apt install unzip

15
Jenkinsfile vendored
View File

@ -1,6 +1,8 @@
pipeline { pipeline {
agent { agent {
dockerfile true dockerfile {
args '-v /var/run/docker.sock:/var/run/docker.sock'
}
} }
parameters { parameters {
string(name: 'KAGGLE_USERNAME', defaultValue: 'alicjaszulecka', description: 'Kaggle username') string(name: 'KAGGLE_USERNAME', defaultValue: 'alicjaszulecka', description: 'Kaggle username')
@ -15,13 +17,14 @@ pipeline {
} }
stage('Build') { stage('Build') {
steps { steps {
withEnv(["KAGGLE_USERNAME=${params.KAGGLE_USERNAME}", script {
"KAGGLE_KEY=${params.KAGGLE_KEY}" ]) { 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 $CUTOFF' sh 'bash ./get_dataset.sh ${params.CUTOFF}'
}
}
archiveArtifacts artifacts: 'artifacts/*', onlyIfSuccessful: true archiveArtifacts artifacts: 'artifacts/*', onlyIfSuccessful: true
} }
} }
} }
} }
}