Skip to content
This repository has been archived by the owner on Jun 29, 2023. It is now read-only.

Docker image based on the official Jenkins docker image with support for pre-installing plug-ins and pre-configuring the Jenkins instance during container start via YAML files using the configuration-as-code plugin.

License

Notifications You must be signed in to change notification settings

vegardit/docker-jenkins-ext

Repository files navigation

docker-jenkins-ext

Build Status License Docker Pulls Docker Stars Contributor Covenant

  1. What is it?
  2. Configuration
  3. License

What is it?

This docker image extends the official Jenkins docker image jenkins:lts/jenkins:lts-slim with support for pre-installing plug-ins during container start and pre-configuring the Jenkins instance during container start via YAML files using the configuration-as-code plugin.

It is automatically built daily to include the latest OS security fixes.

Configuration

Pre-installing Jenkins plugins

You can find a list of available Jenkins plugins at plugins.jenkins.io

To pre-install plugins either:

  1. define the environment variable REQUIRED_PLUGINS with the list of plugins to pre-install (separated by whitespace), e.g.

    $ docker run -rm -it \
      -p 8080:8080 \
      -e "REQUIRED_PLUGINS=greenballs:latest github:latest" \
      vegardit/jenkins-ext:lts-slim
  2. define the environment variable REQUIRED_PLUGINS_FILE pointing to a file containing the list of plugins to pre-install (separated by new lines).

    $ mkdir jenkins_data
    
    $ echo "
      greenballs:latest
      github:latest
      " > jenkins_data/required_plugins.txt
    
    $ docker run -rm -it \
        -p 8080:8080 \
        -e REQUIRED_PLUGINS_FILE=/required_plugins.txt \
        -v myfolder/required_plugins.txt:/required_plugins.txt:ro \
        vegardit/jenkins-ext:lts-slim

To keep pre-installed plugins between container restarts, mount a volume or local folder to /usr/share/jenkins/ref/plugins, for example:

$ mkdir jenkins_data/plugins

$ chown -R 1000:1000 jenkins_data/plugins

$ docker run -rm -it \
  -p 8080:8080 \
  -e "REQUIRED_PLUGINS=greenballs:latest github:latest" \
  -v jenkins_data/plugins:/usr/share/jenkins/ref/plugins:rw
  vegardit/jenkins-ext:lts-slim

Pre-configuring Jenkins

By default the configuration-as-code plugin is configured to look for YAML configuration files under /usr/share/jenkins/ref/config/ during Jenkins start. This path can be configured by changing the environment variable CASC_JENKINS_CONFIG.

# jenkins_data/base-config.yaml
jenkins:
  noUsageStatistics: true
  projectNamingStrategy:
    pattern:
      forceExistingJobs: false
      namePattern: "[a-zA-Z0-9_-. ]+
$ docker run -rm -it \
    -p 8080:8080 \
    -v "jenkins_data/base-config.yaml:/usr/share/jenkins/ref/config/base-config.yaml:ro" \
    vegardit/jenkins-ext:lts-slim

License

All files in this repository are released under the Apache License 2.0.

Individual files contain the following tag instead of the full license text:

SPDX-License-Identifier: Apache-2.0

This enables machine processing of license information based on the SPDX License Identifiers that are available here: https://spdx.org/licenses/.

About

Docker image based on the official Jenkins docker image with support for pre-installing plug-ins and pre-configuring the Jenkins instance during container start via YAML files using the configuration-as-code plugin.

Topics

Resources

License

Code of conduct

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published