chore: add pipeline
This commit is contained in:
commit
3826770c02
42
Jenkinsfile
vendored
Normal file
42
Jenkinsfile
vendored
Normal file
@ -0,0 +1,42 @@
|
|||||||
|
pipeline {
|
||||||
|
agent any
|
||||||
|
environment {
|
||||||
|
REGISTRY = 'registry.bstein.dev'
|
||||||
|
IMAGE = 'infra/harbor-arm-build'
|
||||||
|
}
|
||||||
|
stages {
|
||||||
|
stage('Checkout') {
|
||||||
|
steps {
|
||||||
|
git credentialsId: 'gitea-pat', url: 'https://scm.bstein.dev/bstein/harbor-arm-build.git'
|
||||||
|
}
|
||||||
|
}
|
||||||
|
stage('Build image') {
|
||||||
|
steps {
|
||||||
|
sh '''
|
||||||
|
cat > app.sh <<'APP'
|
||||||
|
#!/usr/bin/env bash
|
||||||
|
echo "hello harbor arm build $(date)"
|
||||||
|
APP
|
||||||
|
chmod +x app.sh
|
||||||
|
cat > Dockerfile <<'DOCKER'
|
||||||
|
FROM alpine:3.20
|
||||||
|
COPY app.sh /usr/local/bin/app.sh
|
||||||
|
RUN chmod +x /usr/local/bin/app.sh
|
||||||
|
ENTRYPOINT ["/usr/local/bin/app.sh"]
|
||||||
|
DOCKER
|
||||||
|
docker build -t $REGISTRY/$IMAGE:latest .
|
||||||
|
'''
|
||||||
|
}
|
||||||
|
}
|
||||||
|
stage('Push image') {
|
||||||
|
steps {
|
||||||
|
withCredentials([usernamePassword(credentialsId: 'harbor-robot', usernameVariable: 'HUSER', passwordVariable: 'HPASS')]) {
|
||||||
|
sh '''
|
||||||
|
echo "$HPASS" | docker login -u "$HUSER" --password-stdin $REGISTRY
|
||||||
|
docker push $REGISTRY/$IMAGE:latest
|
||||||
|
'''
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
Loading…
x
Reference in New Issue
Block a user