Update Jenkins with env and Dockerfile labels

This commit is contained in:
30hours 2024-02-16 02:34:52 +00:00
parent 0b6c085131
commit 257e889b0a
3 changed files with 15 additions and 14 deletions

View file

@ -1,5 +1,6 @@
FROM ubuntu:22.04 as blah2_env FROM ubuntu:22.04 as blah2_env
LABEL maintainer="30hours <nathan@30hours.dev>" LABEL maintainer="30hours <nathan@30hours.dev>"
LABEL org.opencontainers.image.source https://github.com/30hours/blah2
WORKDIR /blah2 WORKDIR /blah2
ADD lib lib ADD lib lib

23
Jenkinsfile vendored
View file

@ -3,8 +3,9 @@ pipeline {
environment { environment {
GHCR_REGISTRY = "ghcr.io" GHCR_REGISTRY = "ghcr.io"
GHCR_USERNAME = credentials('30hours')
GHCR_TOKEN = credentials('ghcr-login') GHCR_TOKEN = credentials('ghcr-login')
BLAH2_NAME = "30hours/blah2"
BLAH2_API_NAME = "30hours/blah2_api"
} }
stages { stages {
@ -15,11 +16,9 @@ pipeline {
} }
stage('Build') { stage('Build') {
steps { steps {
script {
echo 'Building the project' echo 'Building the project'
blah2 = docker.build("30hours/blah2", "--file ./Dockerfile .") sh 'docker build -t $BLAH2_NAME .'
blah2_api = docker.build("30hours/blah2", "--file ./api/Dockerfile ./api") sh 'docker build -t $BLAH2_API_NAME --file ./api/Dockerfile ./api'
}
} }
} }
stage('Test') { stage('Test') {
@ -29,14 +28,12 @@ pipeline {
} }
stage('Push') { stage('Push') {
steps { steps {
script { sh 'echo $GHCR_TOKEN_PSW | docker login ghcr.io -u $GHCR_TOKEN_USR --password-stdin'
echo 'Pushing the application' sh 'docker tag $BLAH2_NAME ghcr.io/$BLAH2_NAME'
sh 'docker tag $BLAH2_API_NAME ghcr.io/$BLAH2_API_NAME'
docker.withRegistry("${GHCR_REGISTRY}", "${GHCR_TOKEN}") { sh 'docker push ghcr.io/$BLAH2_NAME'
blah2.push() sh 'docker push ghcr.io/$BLAH2_API_NAME'
blah2_api.push() sh 'docker logout'
}
}
} }
} }
} }

View file

@ -1,5 +1,8 @@
FROM node:16 FROM node:16
LABEL maintainer="30hours <nathan@30hours.dev>"
LABEL org.opencontainers.image.source https://github.com/30hours/blah2
# Create app directory # Create app directory
WORKDIR /usr/src/app WORKDIR /usr/src/app