Dockerfile

This commit is contained in:
Mateusz 2024-04-01 15:33:41 +02:00
parent 8a6ab2c57a
commit 315e079828
2 changed files with 16 additions and 17 deletions

13
Jenkinsfile vendored
View File

@ -2,7 +2,7 @@ pipeline {
agent { agent {
dockerfile { dockerfile {
filename 'Dockerfile' filename 'Dockerfile'
args '-u root' args '-u root -v -v $HOME:/app'
} }
} }
@ -24,17 +24,16 @@ pipeline {
stage('Run create-dataset script') { stage('Run create-dataset script') {
steps { steps {
withEnv (["KAGGLE_USERNAME=${params.KAGGLE_USERNAME}", "KAGGLE_KEY=${params.KAGGLE_KEY}"]) { withEnv (["KAGGLE_USERNAME=${params.KAGGLE_USERNAME}", "KAGGLE_KEY=${params.KAGGLE_KEY}"]) {
sh 'mkdir /.kaggle' dir ('/app') {
sh 'echo "{\"username\":\"$KAGGLE_USERNAME\",\"key\":\"$KAGGLE_KEY\"}" > /.kaggle/kaggle.json' sh 'chmod +x create-dataset.py'
sh 'chmod 600 /.kaggle/kaggle.json' sh 'python3 ./create-dataset.py'
sh 'chmod +x create-dataset.py' }
sh 'python3 ./create-dataset.py'
} }
} }
} }
stage('Archive Artifacts') { stage('Archive Artifacts') {
steps { steps {
archiveArtifacts artifacts: '/data/*', onlyIfSuccessful: true archiveArtifacts artifacts: '/app/data/*', onlyIfSuccessful: true
} }
} }
} }

View File

@ -70,11 +70,11 @@ def save_undersample_data(
y_train_undersample, y_train_undersample,
y_test_undersample, y_test_undersample,
): ):
undersample_data.to_csv("/data/undersample_data.csv", index=False) undersample_data.to_csv("data/undersample_data.csv", index=False)
X_train_undersample.to_csv("/data/X_train_undersample.csv", index=False) X_train_undersample.to_csv("data/X_train_undersample.csv", index=False)
X_test_undersample.to_csv("/data/X_test_undersample.csv", index=False) X_test_undersample.to_csv("data/X_test_undersample.csv", index=False)
y_train_undersample.to_csv("/data/y_train_undersample.csv", index=False) y_train_undersample.to_csv("data/y_train_undersample.csv", index=False)
y_test_undersample.to_csv("/data/y_test_undersample.csv", index=False) y_test_undersample.to_csv("data/y_test_undersample.csv", index=False)
def split_whole_data(df): def split_whole_data(df):
@ -88,11 +88,11 @@ def split_whole_data(df):
def save_whole_data(df, X_train, X_test, y_train, y_test): def save_whole_data(df, X_train, X_test, y_train, y_test):
df.to_csv("/data/creditcard.csv", index=False) df.to_csv("data/creditcard.csv", index=False)
X_train.to_csv("/data/X_train.csv", index=False) X_train.to_csv("data/X_train.csv", index=False)
X_test.to_csv("/data/X_test.csv", index=False) X_test.to_csv("data/X_test.csv", index=False)
y_train.to_csv("/data/y_train.csv", index=False) y_train.to_csv("data/y_train.csv", index=False)
y_test.to_csv("/data/y_test.csv", index=False) y_test.to_csv("data/y_test.csv", index=False)
def main(): def main():