Compare commits
26 Commits
af3387d49d
...
main
Author | SHA1 | Date | |
---|---|---|---|
5944805d27 | |||
355dcb3816 | |||
16f4ca20a1 | |||
5c7e43445a | |||
5f367cc3aa | |||
ece29dd217 | |||
2ca9c9dbe4 | |||
6df34b6236 | |||
5966d4f447 | |||
3b3c3558a1 | |||
ed74cfcdf4 | |||
612f1350f8 | |||
6141fdc54c | |||
819392a885 | |||
51c04bc837 | |||
e8ac6e80bf | |||
ba3a0025e7 | |||
5d4415b9a1 | |||
a56f0a86e1 | |||
d4b7efc44a | |||
44ccc78236 | |||
1ab094973b | |||
79f46c59a2 | |||
c8060531d6 | |||
619613928d | |||
befe29b9a4 |
8
.vscode/jenkins-ssh-docker-agent.code-workspace
vendored
Normal file
8
.vscode/jenkins-ssh-docker-agent.code-workspace
vendored
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
{
|
||||||
|
"folders": [
|
||||||
|
{
|
||||||
|
"path": ".."
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"settings": {}
|
||||||
|
}
|
36
Dockerfile
36
Dockerfile
@ -1,11 +1,10 @@
|
|||||||
FROM jenkins/ssh-agent
|
FROM jenkins/ssh-agent:latest-jdk21
|
||||||
|
|
||||||
RUN groupadd -g 281 docker
|
RUN groupadd -g 281 docker
|
||||||
RUN usermod -aG docker jenkins
|
RUN usermod -aG docker jenkins
|
||||||
|
|
||||||
RUN apt-get update
|
RUN apt-get update
|
||||||
RUN apt-get install -y\
|
RUN apt-get install -y ca-certificates \
|
||||||
ca-certificates \
|
|
||||||
curl \
|
curl \
|
||||||
gnupg
|
gnupg
|
||||||
|
|
||||||
@ -14,33 +13,14 @@ RUN curl -fsSL https://download.docker.com/linux/debian/gpg | gpg --dearmor -o /
|
|||||||
|
|
||||||
RUN echo \
|
RUN echo \
|
||||||
"deb [arch="$(dpkg --print-architecture)" signed-by=/etc/apt/keyrings/docker.gpg] https://download.docker.com/linux/debian \
|
"deb [arch="$(dpkg --print-architecture)" signed-by=/etc/apt/keyrings/docker.gpg] https://download.docker.com/linux/debian \
|
||||||
"$(. /etc/os-release && echo "$VERSION_CODENAME")" stable" | \
|
"$(. /etc/os-release && echo "$VERSION_CODENAME")" stable" | tee /etc/apt/sources.list.d/docker.list >/dev/null
|
||||||
tee /etc/apt/sources.list.d/docker.list > /dev/null
|
|
||||||
|
|
||||||
RUN apt-get update
|
RUN apt-get update
|
||||||
RUN apt-get install -y docker-ce-cli
|
RUN apt-get install -y docker-ce-cli
|
||||||
|
|
||||||
# Install flutter
|
#Install OpenSSL
|
||||||
RUN apt-get update
|
RUN apt-get install -y openssl
|
||||||
RUN apt-get install -y\
|
|
||||||
curl git wget \
|
|
||||||
unzip libgconf-2-4 gdb \
|
|
||||||
libstdc++6 libglu1-mesa fonts-droid-fallback \
|
|
||||||
lib32stdc++6 python3 sed
|
|
||||||
|
|
||||||
RUN git clone https://github.com/flutter/flutter.git /usr/local/flutter
|
#Install git lfs
|
||||||
RUN git config --global --add safe.directory /usr/local/flutter
|
RUN apt-get install -y git-lfs
|
||||||
|
RUN git lfs install --system
|
||||||
ENV PATH="/usr/local/flutter/bin:/usr/local/flutter/bin/cache/dart-sdk/bin:${PATH}"
|
|
||||||
|
|
||||||
RUN chown -R jenkins:jenkins /usr/local/flutter
|
|
||||||
|
|
||||||
# Run flutter doctor and upgrade
|
|
||||||
USER jenkins
|
|
||||||
|
|
||||||
RUN flutter config --no-cli-animations
|
|
||||||
RUN flutter doctor -v
|
|
||||||
RUN flutter channel master
|
|
||||||
RUN flutter upgrade
|
|
||||||
|
|
||||||
USER root
|
|
||||||
|
40
Jenkinsfile
vendored
40
Jenkinsfile
vendored
@ -1,7 +1,9 @@
|
|||||||
#!groovy
|
#!groovy
|
||||||
|
|
||||||
pipeline {
|
pipeline {
|
||||||
agent none
|
agent {
|
||||||
|
label 'linux'
|
||||||
|
}
|
||||||
|
|
||||||
stages {
|
stages {
|
||||||
stage('Build/Push Docker Image') {
|
stage('Build/Push Docker Image') {
|
||||||
@ -9,42 +11,58 @@ pipeline {
|
|||||||
beforeAgent true;
|
beforeAgent true;
|
||||||
branch 'main'
|
branch 'main'
|
||||||
}
|
}
|
||||||
agent {
|
|
||||||
label 'linux'
|
|
||||||
}
|
|
||||||
environment {
|
environment {
|
||||||
DOCKER_HUB_CREDENTIALS = credentials('docker-hub-fah16145')
|
def tag = sh(returnStdout: true, script: 'git rev-parse --short=10 HEAD').trim()
|
||||||
}
|
}
|
||||||
stages {
|
stages {
|
||||||
stage('Login') {
|
stage('Login') {
|
||||||
|
environment {
|
||||||
|
DOCKER_HUB_CREDENTIALS = credentials('docker-hub-fah16145')
|
||||||
|
PACKAGE_REGISTRY_CREDENTIALS = credentials('gitea-package-registry-jenkins-user')
|
||||||
|
}
|
||||||
steps {
|
steps {
|
||||||
sh 'docker login -u ${DOCKER_HUB_CREDENTIALS_USR} -p ${DOCKER_HUB_CREDENTIALS_PSW}'
|
sh 'docker login -u ${DOCKER_HUB_CREDENTIALS_USR} -p ${DOCKER_HUB_CREDENTIALS_PSW}'
|
||||||
|
sh 'docker login -u ${PACKAGE_REGISTRY_CREDENTIALS_USR} -p ${PACKAGE_REGISTRY_CREDENTIALS_PSW} gitea.fahrecker.com'
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
stage('Build & Push') {
|
||||||
|
parallel {
|
||||||
stage('Default Image') {
|
stage('Default Image') {
|
||||||
stages {
|
stages {
|
||||||
stage('Build') {
|
stage('Build Default Image') {
|
||||||
steps {
|
steps {
|
||||||
sh 'docker build -t fah16145/jenkins-ssh-docker-agent:latest .'
|
sh '''docker build \
|
||||||
|
-t fah16145/jenkins-ssh-docker-agent:latest \
|
||||||
|
-t gitea.fahrecker.com/andreas-personal/jenkins-ssh-docker-agent:latest \
|
||||||
|
.
|
||||||
|
'''
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
stage('Push') {
|
stage('Push Default Image') {
|
||||||
steps {
|
steps {
|
||||||
sh 'docker push fah16145/jenkins-ssh-docker-agent:latest'
|
sh 'docker push fah16145/jenkins-ssh-docker-agent:latest'
|
||||||
|
sh 'docker push gitea.fahrecker.com/andreas-personal/jenkins-ssh-docker-agent:latest'
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
stage('Alpine Image') {
|
stage('Alpine Image') {
|
||||||
stages {
|
stages {
|
||||||
stage('Build') {
|
stage('Build Alpine Image') {
|
||||||
steps {
|
steps {
|
||||||
sh 'docker build -t fah16145/jenkins-ssh-docker-agent:alpine alpine/'
|
sh '''docker build \
|
||||||
|
-t fah16145/jenkins-ssh-docker-agent:alpine \
|
||||||
|
-t gitea.fahrecker.com/andreas-personal/jenkins-ssh-docker-agent:alpine \
|
||||||
|
alpine/
|
||||||
|
'''
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
stage('Push') {
|
stage('Push Alpine Image') {
|
||||||
steps {
|
steps {
|
||||||
sh 'docker push fah16145/jenkins-ssh-docker-agent:alpine'
|
sh 'docker push fah16145/jenkins-ssh-docker-agent:alpine'
|
||||||
|
sh 'docker push gitea.fahrecker.com/andreas-personal/jenkins-ssh-docker-agent:alpine'
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,14 +1,25 @@
|
|||||||
FROM jenkins/ssh-agent:alpine
|
FROM jenkins/ssh-agent:alpine-jdk21
|
||||||
|
|
||||||
RUN addgroup --gid 281 docker
|
RUN addgroup --gid 281 docker
|
||||||
RUN addgroup jenkins docker
|
RUN addgroup jenkins docker
|
||||||
|
|
||||||
RUN apk add --no-cache docker docker-compose
|
RUN apk add --no-cache docker docker-compose
|
||||||
|
|
||||||
# Install flutter
|
# Install tea
|
||||||
RUN apk add --no-cache flutter
|
RUN apk add --no-cache tea
|
||||||
|
|
||||||
RUN flutter config --no-cli-animations
|
#Install OpenSSL
|
||||||
RUN flutter doctor -v
|
RUN apk add --no-cache openssl
|
||||||
RUN flutter channel master
|
|
||||||
RUN flutter upgrade
|
#Install git lfs
|
||||||
|
RUN apk add --no-cache git-lfs
|
||||||
|
RUN git lfs install --system
|
||||||
|
|
||||||
|
|
||||||
|
# TODO: doesnt work still, something about not finding the java binary over ssh
|
||||||
|
# Configure SSH to behave more like Debian - load environment properly
|
||||||
|
#RUN echo 'PermitUserEnvironment yes' >> /etc/ssh/sshd_config
|
||||||
|
#RUN echo 'UsePAM yes' >> /etc/ssh/sshd_config
|
||||||
|
|
||||||
|
# Add Java to environment file that SSH will read
|
||||||
|
#RUN echo 'PATH=/opt/java/openjdk/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin' >> /etc/environment
|
Reference in New Issue
Block a user