/jenkins-docker-nginx

Dockerfile for NGINX frontend to Jenkins

Primary LanguageShellOtherNOASSERTION

Deprecation Warning

As of May 2021, this project has been deprecated and is now archived in favor of using vela

jenkins-docker-nginx

license

Supported tags and respective Dockerfile links

Quick reference

Usage

Variable replacement

Out-of-the-box, Nginx doesn't support using environment variables inside most configuration blocks. We will be using envsubst to replace variables within the default.conf.template and index.html.template files.

This is done by using CMD /wrapper.sh inside of the Dockerfile. The wrapper.sh is a simple shell script that calls envsubst to replace $DOMAIN and $SUB_DOMAIN with the values of environment variables that you define.

Modify configuration files

You can simply modify configuration files via reusing the docker image, for example:

FROM target/jenkins-docker-nginx

COPY <my default template> /etc/nginx/conf.d/default.conf.template

Docker Swarm

Assumptions

  • Existing Docker Swarm cluster with version >= 1.13
  • Overlay network named jenkins
  • Using Docker secrets for ssl certificates

Deployment

The following steps need to be done on a Docker Swarm manager

  1. Create a Docker swarm overlay network with:

    docker network create --driver overlay --subnet <Subnet in CIDR format> jenkins
  2. Create Docker secrets

    docker secret create cert.crt <path to certificate>
    docker secret create cert.key <path to key>
  3. Modify the docker-compose.yml file to have company specific settings

  4. Create a docker stack

    docker stack deploy -c docker-compose.yml service