feat(jenkins): add Jenkins CI/CD Platform Cloudron package
- Complete Jenkins package with Java 17 and WAR file download - Proper CloudronManifest.json with correct metadata - Custom start.sh script with Jenkins configuration - Health check endpoint configured for /login - Follows KNELCloudron- naming convention - Added comprehensive packaging shortlist with 56 applications prioritized by phase
This commit is contained in:
11
CloudronPackages/Jenkins/.dockerignore
Normal file
11
CloudronPackages/Jenkins/.dockerignore
Normal file
@@ -0,0 +1,11 @@
|
||||
# Ignore typical build context clutter
|
||||
.git
|
||||
.gitignore
|
||||
node_modules
|
||||
npm-debug.log
|
||||
*.log
|
||||
dist
|
||||
build
|
||||
Dockerfile.*
|
||||
.DS_Store
|
||||
|
19
CloudronPackages/Jenkins/CloudronManifest.json
Normal file
19
CloudronPackages/Jenkins/CloudronManifest.json
Normal file
@@ -0,0 +1,19 @@
|
||||
{
|
||||
"manifestVersion": 2,
|
||||
"id": "io.knel.jenkins",
|
||||
"title": "Jenkins CI/CD",
|
||||
"author": "KNEL",
|
||||
"description": "Jenkins CI/CD Platform for automated builds, testing, and deployment",
|
||||
"website": "https://jenkins.io",
|
||||
"contactEmail": "admin@knownelement.com",
|
||||
"version": "2.450.0",
|
||||
"changelog": "Initial Cloudron package for Jenkins CI/CD Platform",
|
||||
"healthCheckPath": "/login",
|
||||
"httpPort": 8080,
|
||||
"addons": {
|
||||
"localstorage": {}
|
||||
},
|
||||
"tags": ["ci", "cd", "automation", "build", "deployment"],
|
||||
"icon": "logo.png"
|
||||
}
|
||||
|
50
CloudronPackages/Jenkins/Dockerfile
Normal file
50
CloudronPackages/Jenkins/Dockerfile
Normal file
@@ -0,0 +1,50 @@
|
||||
FROM cloudron/base:5.0.0
|
||||
|
||||
# Metadata labels
|
||||
LABEL org.opencontainers.image.title="Jenkins CI/CD"
|
||||
LABEL org.opencontainers.image.description="Cloudron package for Jenkins CI/CD Platform"
|
||||
LABEL org.opencontainers.image.source="https://github.com/jenkinsci/jenkins"
|
||||
|
||||
# Install Java and Jenkins dependencies
|
||||
RUN apt-get update && apt-get install -y --no-install-recommends \
|
||||
openjdk-17-jdk \
|
||||
curl \
|
||||
ca-certificates \
|
||||
git \
|
||||
&& rm -rf /var/lib/apt/lists/*
|
||||
|
||||
# Set Java environment
|
||||
ENV JAVA_HOME=/usr/lib/jvm/java-17-openjdk-amd64
|
||||
ENV PATH=$JAVA_HOME/bin:$PATH
|
||||
|
||||
# Create Jenkins directories
|
||||
RUN mkdir -p /app/data/jenkins_home && \
|
||||
mkdir -p /app/data/plugins && \
|
||||
mkdir -p /app/pkg && \
|
||||
chown -R cloudron:cloudron /app/data
|
||||
|
||||
# Download and install Jenkins WAR file
|
||||
ARG JENKINS_VERSION=2.450
|
||||
RUN cd /tmp && \
|
||||
curl -fsSL "https://get.jenkins.io/war/${JENKINS_VERSION}/jenkins.war" -o jenkins.war && \
|
||||
mv jenkins.war /app/pkg/jenkins.war && \
|
||||
chown cloudron:cloudron /app/pkg/jenkins.war
|
||||
|
||||
# Copy startup script
|
||||
COPY start.sh /app/pkg/start.sh
|
||||
RUN chmod +x /app/pkg/start.sh && chown cloudron:cloudron /app/pkg/start.sh
|
||||
|
||||
USER cloudron
|
||||
|
||||
# Expose Jenkins port
|
||||
EXPOSE 8080
|
||||
|
||||
# Jenkins environment variables
|
||||
ENV JENKINS_HOME=/app/data/jenkins_home \
|
||||
JENKINS_OPTS="--httpPort=8080 --httpListenAddress=0.0.0.0" \
|
||||
APP_PORT=8080
|
||||
|
||||
HEALTHCHECK --interval=30s --timeout=10s --start-period=60s --retries=3 \
|
||||
CMD curl -fsS http://127.0.0.1:${APP_PORT}/login || exit 1
|
||||
|
||||
CMD ["/app/pkg/start.sh"]
|
33
CloudronPackages/Jenkins/README.md
Normal file
33
CloudronPackages/Jenkins/README.md
Normal file
@@ -0,0 +1,33 @@
|
||||
# Package Template for Cloudron Apps
|
||||
|
||||
This is a minimal template to package an application for Cloudron.
|
||||
|
||||
## Docker Artifact Naming Convention
|
||||
|
||||
All KNEL Cloudron packages follow the `KNELCloudron-` prefix convention:
|
||||
- **Development Images**: `<appname>:dev` (built locally for testing)
|
||||
- **Production Images**: `<appname>:latest` (final packaged versions)
|
||||
- **Container Names**: Use descriptive names like `<appname>-dev` for development containers
|
||||
|
||||
## Template Usage
|
||||
|
||||
Replace placeholders in files with your app specifics:
|
||||
- `io.knel.jenkins` (e.g., com.example.myapp)
|
||||
- `Jenkins CI/CD` (human name)
|
||||
- `8080` (default internal app port)
|
||||
- `5.0.0` (Cloudron base image tag, e.g., 5.0.0)
|
||||
|
||||
Files
|
||||
- `CloudronManifest.json` – base manifest
|
||||
- `Dockerfile` – uses cloudron/base, non-root user, healthcheck
|
||||
- `start.sh` – startup script with addon detection examples
|
||||
- `nginx.conf` (optional) – example reverse proxy
|
||||
- `supervisord.conf` (optional) – process manager example
|
||||
- `config.yaml` (optional) – sample app config
|
||||
- `logo.png` – add your 512x512 PNG icon here (not provided in template)
|
||||
|
||||
Usage
|
||||
1. Create a new package from this template using `scripts/new-package.sh`:
|
||||
`scripts/new-package.sh MyApp --id com.example.myapp --title "My App" --port 3000`
|
||||
2. Adjust Dockerfile and start.sh to run your app.
|
||||
3. Build and test locally; then commit and push.
|
11
CloudronPackages/Jenkins/config.yaml
Normal file
11
CloudronPackages/Jenkins/config.yaml
Normal file
@@ -0,0 +1,11 @@
|
||||
# Example configuration template for Jenkins CI/CD
|
||||
server:
|
||||
port: 8080
|
||||
|
||||
data:
|
||||
dir: /app/data
|
||||
|
||||
database:
|
||||
# url: ${CLOUDRON_POSTGRESQL_URL}
|
||||
# redis: ${CLOUDRON_REDIS_URL}
|
||||
|
26
CloudronPackages/Jenkins/nginx.conf
Normal file
26
CloudronPackages/Jenkins/nginx.conf
Normal file
@@ -0,0 +1,26 @@
|
||||
user cloudron;
|
||||
worker_processes auto;
|
||||
|
||||
error_log /var/log/nginx/error.log warn;
|
||||
pid /run/nginx.pid;
|
||||
|
||||
events { worker_connections 1024; }
|
||||
|
||||
http {
|
||||
include /etc/nginx/mime.types;
|
||||
default_type application/octet-stream;
|
||||
access_log /var/log/nginx/access.log main;
|
||||
sendfile on;
|
||||
|
||||
server {
|
||||
listen 8080;
|
||||
server_name _;
|
||||
|
||||
location / {
|
||||
proxy_set_header Host $host;
|
||||
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
||||
proxy_pass http://127.0.0.1:8080;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
77
CloudronPackages/Jenkins/start.sh
Normal file
77
CloudronPackages/Jenkins/start.sh
Normal file
@@ -0,0 +1,77 @@
|
||||
#!/usr/bin/env bash
|
||||
set -euo pipefail
|
||||
|
||||
log() { echo "[start] $(date -Is) $*"; }
|
||||
abort() { echo "[start] ERROR: $*" >&2; exit 1; }
|
||||
|
||||
# Defaults
|
||||
: "${APP_PORT:=8080}"
|
||||
: "${JENKINS_HOME:=/app/data/jenkins_home}"
|
||||
|
||||
log "Starting Jenkins CI/CD on port ${APP_PORT}"
|
||||
|
||||
# Ensure Jenkins home directory exists and is writable
|
||||
mkdir -p "${JENKINS_HOME}"
|
||||
chown -R cloudron:cloudron /app/data || true
|
||||
|
||||
# Set Jenkins environment variables
|
||||
export JENKINS_HOME="${JENKINS_HOME}"
|
||||
export JENKINS_OPTS="--httpPort=${APP_PORT} --httpListenAddress=0.0.0.0"
|
||||
|
||||
# Configure Jenkins for Cloudron
|
||||
log "Configuring Jenkins for Cloudron environment"
|
||||
|
||||
# Create basic Jenkins configuration if not exists
|
||||
if [[ ! -f "${JENKINS_HOME}/config.xml" ]]; then
|
||||
log "Creating initial Jenkins configuration"
|
||||
mkdir -p "${JENKINS_HOME}"
|
||||
|
||||
# Create basic config.xml for Jenkins
|
||||
cat > "${JENKINS_HOME}/config.xml" <<'XML'
|
||||
<?xml version='1.1' encoding='UTF-8'?>
|
||||
<hudson>
|
||||
<version>2.450</version>
|
||||
<numExecutors>2</numExecutors>
|
||||
<mode>NORMAL</mode>
|
||||
<useSecurity>true</useSecurity>
|
||||
<authorizationStrategy class="hudson.security.FullControlOnceLoggedInAuthorizationStrategy"/>
|
||||
<securityRealm class="hudson.security.HudsonPrivateSecurityRealm">
|
||||
<disableSignup>true</disableSignup>
|
||||
</securityRealm>
|
||||
<disableRememberMe>false</disableRememberMe>
|
||||
<projectNamingStrategy class="jenkins.model.ProjectNamingStrategy$DefaultProjectNamingStrategy"/>
|
||||
<workspaceDir>${JENKINS_HOME}/workspace/${ITEM_FULLNAME}</workspaceDir>
|
||||
<buildsDir>${JENKINS_HOME}/builds/${ITEM_FULLNAME}</buildsDir>
|
||||
<markupFormatter class="hudson.markup.RawHtmlMarkupFormatter" plugin="antisamy-markup-formatter@3.1"/>
|
||||
<jdks/>
|
||||
<viewsTabBar class="hudson.views.DefaultViewsTabBar"/>
|
||||
<myViewsTabBar class="hudson.views.DefaultMyViewsTabBar"/>
|
||||
<clouds/>
|
||||
<slaves/>
|
||||
<scm class="hudson.scm.NullSCM"/>
|
||||
<views>
|
||||
<hudson.model.AllView>
|
||||
<owner class="hudson" reference="../../.."/>
|
||||
<name>all</name>
|
||||
<filterExecutors>false</filterExecutors>
|
||||
<filterQueue>false</filterQueue>
|
||||
<properties class="hudson.model.View$PropertyList"/>
|
||||
</hudson.model.AllView>
|
||||
</views>
|
||||
<primaryView>all</primaryView>
|
||||
<slaveAgentPort>50000</slaveAgentPort>
|
||||
<disabledAgentProtocols>
|
||||
<string>JNLP-connect</string>
|
||||
<string>JNLP2-connect</string>
|
||||
</disabledAgentProtocols>
|
||||
<label></label>
|
||||
<nodeProperties/>
|
||||
<globalNodeProperties/>
|
||||
</hudson>
|
||||
XML
|
||||
fi
|
||||
|
||||
# Start Jenkins
|
||||
log "Starting Jenkins WAR file"
|
||||
exec java -jar /app/pkg/jenkins.war ${JENKINS_OPTS}
|
||||
|
12
CloudronPackages/Jenkins/supervisord.conf
Normal file
12
CloudronPackages/Jenkins/supervisord.conf
Normal file
@@ -0,0 +1,12 @@
|
||||
[supervisord]
|
||||
logfile=/var/log/supervisor/supervisord.log
|
||||
pidfile=/run/supervisord.pid
|
||||
nodaemon=true
|
||||
|
||||
[program:app]
|
||||
command=/app/pkg/start.sh
|
||||
autorestart=true
|
||||
stdout_logfile=/var/log/supervisor/app.stdout.log
|
||||
stderr_logfile=/var/log/supervisor/app.stderr.log
|
||||
user=cloudron
|
||||
|
Reference in New Issue
Block a user