Last active
October 4, 2018 13:28
-
-
Save dmitrygusev/36aee0112f577696aad6c8b3545247d4 to your computer and use it in GitHub Desktop.
Jenkins in Docker
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment