Skip to content

Instantly share code, notes, and snippets.

@dmitrygusev
Last active October 4, 2018 13:28
Show Gist options
  • Save dmitrygusev/36aee0112f577696aad6c8b3545247d4 to your computer and use it in GitHub Desktop.
Save dmitrygusev/36aee0112f577696aad6c8b3545247d4 to your computer and use it in GitHub Desktop.

Revisions

  1. dmitrygusev revised this gist Oct 3, 2018. 1 changed file with 35 additions and 0 deletions.
    35 changes: 35 additions & 0 deletions docker-compose.jenkins.yml
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,35 @@
    version: '2.4'

    services:

    jenkins:
    image: ${JENKINS_IMAGE}
    build: data/jenkins
    ports:
    - "${JENKINS_HOST_PORT:-8080}:8080"
    - "33050:50000"
    # mem_limit: 6g
    environment:
    JAVA_OPTS: |-
    -Dhudson.model.DirectoryBrowserSupport.CSP="sandbox allow-same-origin allow-scripts; default-src 'self'; script-src 'self' 'unsafe-inline'; img-src 'self'; style-src 'self' 'unsafe-inline'; font-src 'self'"
    -Dhudson.footerURL=https://jenkins.example.com
    -Xms1g -Xmx3g -XX:+UseG1GC
    EC2_INSTANCE_REGION: ${EC2_INSTANCE_REGION}
    AWS_CONFIG_FILE: /opt/aws/config
    volumes:
    - /var/run/docker.sock:/var/run/docker.sock
    - /usr/bin/docker:/usr/bin/docker
    - /usr/lib64/libltdl.so.7:/usr/lib/libltdl.so.7
    - /usr/local/bin/docker-compose:/usr/local/bin/docker-compose
    - /var/jenkins_home:/var/jenkins_home
    - ./data/jenkins/aws:/opt/aws
    logging:
    driver: awslogs
    options:
    awslogs-region: ${EC2_INSTANCE_REGION}
    awslogs-group: docker
    awslogs-stream: ${DEPLOYABLE_NAME}-jenkins

    nginx:
    depends_on:
    - jenkins
  2. dmitrygusev created this gist Oct 3, 2018.
    15 changes: 15 additions & 0 deletions Dockerfile
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,15 @@
    FROM jenkins/jenkins:2.138.1

    USER root

    RUN apt-get update -y && apt-get install -y \
    python-pip \
    sudo

    RUN pip install awscli --upgrade

    CMD DOCKER_GID=$(stat -c '%g' /var/run/docker.sock) && \
    groupadd -for -g ${DOCKER_GID} docker && \
    usermod -aG docker jenkins && \
    chown -R 1000 "${JENKINS_HOME}" && \
    sudo -E -H -u jenkins bash -c /usr/local/bin/jenkins.sh