mirror of
https://github.com/30hours/blah2.git
synced 2024-11-08 12:25:42 +00:00
Update Jenkins with env and Dockerfile labels
This commit is contained in:
parent
0b6c085131
commit
257e889b0a
3 changed files with 15 additions and 14 deletions
|
@ -1,5 +1,6 @@
|
|||
FROM ubuntu:22.04 as blah2_env
|
||||
LABEL maintainer="30hours <nathan@30hours.dev>"
|
||||
LABEL org.opencontainers.image.source https://github.com/30hours/blah2
|
||||
|
||||
WORKDIR /blah2
|
||||
ADD lib lib
|
||||
|
|
25
Jenkinsfile
vendored
25
Jenkinsfile
vendored
|
@ -3,8 +3,9 @@ pipeline {
|
|||
|
||||
environment {
|
||||
GHCR_REGISTRY = "ghcr.io"
|
||||
GHCR_USERNAME = credentials('30hours')
|
||||
GHCR_TOKEN = credentials('ghcr-login')
|
||||
BLAH2_NAME = "30hours/blah2"
|
||||
BLAH2_API_NAME = "30hours/blah2_api"
|
||||
}
|
||||
|
||||
stages {
|
||||
|
@ -15,11 +16,9 @@ pipeline {
|
|||
}
|
||||
stage('Build') {
|
||||
steps {
|
||||
script {
|
||||
echo 'Building the project'
|
||||
blah2 = docker.build("30hours/blah2", "--file ./Dockerfile .")
|
||||
blah2_api = docker.build("30hours/blah2", "--file ./api/Dockerfile ./api")
|
||||
}
|
||||
echo 'Building the project'
|
||||
sh 'docker build -t $BLAH2_NAME .'
|
||||
sh 'docker build -t $BLAH2_API_NAME --file ./api/Dockerfile ./api'
|
||||
}
|
||||
}
|
||||
stage('Test') {
|
||||
|
@ -29,14 +28,12 @@ pipeline {
|
|||
}
|
||||
stage('Push') {
|
||||
steps {
|
||||
script {
|
||||
echo 'Pushing the application'
|
||||
|
||||
docker.withRegistry("${GHCR_REGISTRY}", "${GHCR_TOKEN}") {
|
||||
blah2.push()
|
||||
blah2_api.push()
|
||||
}
|
||||
}
|
||||
sh 'echo $GHCR_TOKEN_PSW | docker login ghcr.io -u $GHCR_TOKEN_USR --password-stdin'
|
||||
sh 'docker tag $BLAH2_NAME ghcr.io/$BLAH2_NAME'
|
||||
sh 'docker tag $BLAH2_API_NAME ghcr.io/$BLAH2_API_NAME'
|
||||
sh 'docker push ghcr.io/$BLAH2_NAME'
|
||||
sh 'docker push ghcr.io/$BLAH2_API_NAME'
|
||||
sh 'docker logout'
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,5 +1,8 @@
|
|||
FROM node:16
|
||||
|
||||
LABEL maintainer="30hours <nathan@30hours.dev>"
|
||||
LABEL org.opencontainers.image.source https://github.com/30hours/blah2
|
||||
|
||||
# Create app directory
|
||||
WORKDIR /usr/src/app
|
||||
|
||||
|
|
Loading…
Reference in a new issue