This commit is contained in:
s464958 2024-12-05 18:27:26 +01:00
parent 6e6cfef8df
commit 326a1f1210

View File

@ -1,24 +1,27 @@
pipeline {
agent any
environment {
IMG_NAME = 'firmtracker-server'
DOCKER_REPO = 'maciejm0101/firmtracker'
}
stages {
stage('Restore Dependencies') {
stage('build') {
steps {
echo 'Restoring dependencies...'
sh 'dotnet restore'
script {
sh 'docker build -t ${IMG_NAME} .'
sh 'docker tag ${IMG_NAME} ${DOCKER_REPO}:${IMG_NAME}'
}
}
}
stage('Build') {
stage('push') {
steps {
echo 'Building the project...'
sh 'dotnet build --configuration Release'
}
}
stage('Publish') {
steps {
echo 'Publishing the project...'
sh 'dotnet publish --configuration Release --output ./publish'
withCredentials([usernamePassword(credentialsId: 'DockerHub-LG', passwordVariable: 'PSWD', usernameVariable: 'LOGIN')]) {
script {
sh 'echo ${PSWD} | docker login -u ${LOGIN} --password-stdin'
sh 'docker push ${DOCKER_REPO}:${IMG_NAME}'
}
}
}
}
}
}
}