{"id":19855418,"url":"https://github.com/gtesei/patterns_for_continuous_integration_docker_jenkins","last_synced_at":"2026-04-11T12:01:52.772Z","repository":{"id":71994729,"uuid":"152814569","full_name":"gtesei/Patterns_for_Continuous_Integration_Docker_Jenkins","owner":"gtesei","description":"Patterns of Continuous Integration for Data Science Python Projects","archived":false,"fork":false,"pushed_at":"2018-10-19T21:15:03.000Z","size":471,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-01-11T13:53:16.805Z","etag":null,"topics":["coverage","coveralls","docker","jenkins","mkdocs","pypi","pytest","python","readthedocs"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"bsd-3-clause","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/gtesei.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2018-10-12T22:40:13.000Z","updated_at":"2022-11-10T21:12:35.000Z","dependencies_parsed_at":null,"dependency_job_id":"b30cd841-8c45-4a58-ac95-9db67d70f856","html_url":"https://github.com/gtesei/Patterns_for_Continuous_Integration_Docker_Jenkins","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gtesei%2FPatterns_for_Continuous_Integration_Docker_Jenkins","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gtesei%2FPatterns_for_Continuous_Integration_Docker_Jenkins/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gtesei%2FPatterns_for_Continuous_Integration_Docker_Jenkins/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gtesei%2FPatterns_for_Continuous_Integration_Docker_Jenkins/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/gtesei","download_url":"https://codeload.github.com/gtesei/Patterns_for_Continuous_Integration_Docker_Jenkins/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":241245396,"owners_count":19933295,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["coverage","coveralls","docker","jenkins","mkdocs","pypi","pytest","python","readthedocs"],"created_at":"2024-11-12T14:12:41.111Z","updated_at":"2026-04-11T12:01:47.736Z","avatar_url":"https://github.com/gtesei.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Patterns for Continuous Integration with Docker using Jenkins \n\n__Full story:__ [Patterns of Continuous Integration for Data Science Python Projects](https://medium.com/@gtesei/the-ci-arsenal-that-any-open-source-machine-learning-python-project-should-consider-e34759dd66c4)\n\n![Conceptual Schema](https://raw.githubusercontent.com/gtesei/Patterns_for_Continuous_Integration_Docker_Jenkins/master/img/Docker_Repo_Pattern_Jenkins.png)\n\n## Install Jenkins via Docker \n\nsee https://github.com/jenkinsci/docker/blob/master/README.md\n\n### Dockerfile \n \n```docker\nFROM jenkins/jenkins:lts\n\nUSER root\n\nRUN apt-get update \u0026\u0026 \\\napt-get -y install apt-transport-https \\\n    ca-certificates \\\n    curl \\\n    gnupg2 \\\n    software-properties-common \u0026\u0026 \\\ncurl -fsSL https://download.docker.com/linux/$(. /etc/os-release; echo \"$ID\")/gpg \u003e /tmp/dkey; apt-key add /tmp/dkey \u0026\u0026 \\\nadd-apt-repository \\\n    \"deb [arch=amd64] https://download.docker.com/linux/$(. /etc/os-release; echo \"$ID\") \\\n    $(lsb_release -cs) \\\n    stable\" \u0026\u0026 \\\napt-get update \u0026\u0026 \\\napt-get -y install docker-ce\n\nRUN apt-get install -y docker-ce\n\nRUN usermod -a -G root jenkins\n\nRUN usermod -a -G sudo jenkins\n\nUSER jenkins\n\n```\n\n### Build Docker Image \n\n```sh\ndocker build -f Dockerfile_Jenkins -t my-jenkins . \n```\n\n### Start Container \n\n```sh\ndocker run -p 8080:8080 -p 50000:50000 --name myjenkins  -v /var/run/docker.sock:/var/run/docker.sock my-jenkins  \n```\n  \n### Enter in Docker Container and Execute\n\n```sh\ndocker exec -it myjenkins bash\n```\n\n__Note__: use option ```-u 0``` to enter as root \n\n```sh\ngit config --global http.sslverify false\n```\n\n## Using credentials with Jenkins \n\nNecessary for \n\n* Docker Hub account \n* Coveralls account (option)\n\nsee https://jenkins.io/doc/book/using/using-credentials/ \n\n* From the Jenkins home page (i.e. the Dashboard of the Jenkins classic UI), click Credentials \u003e System on the left.\n* Under System, click the Global credentials (unrestricted) link to access this default domain.\n\n![Using credentials with Jenkins](https://raw.githubusercontent.com/gtesei/Patterns_for_Continuous_Integration_Docker_Jenkins/master/img/jen_cred.PNG)\n\n\n![Using credentials with Jenkins](https://raw.githubusercontent.com/gtesei/Patterns_for_Continuous_Integration_Docker_Jenkins/master/img/jen_cred.PNG)\n\n![Using credentials with Jenkins](https://raw.githubusercontent.com/gtesei/Patterns_for_Continuous_Integration_Docker_Jenkins/master/img/jen_cred2.PNG)\n\n## Creating Jenkins Pipeline for a Git Project \n\n#### New Item \u003e\u003e Enter pipeline name and select Pipeline \u003e\u003e OK \n\n![New Item \u003e\u003e Enter pipeline name and select Pipeline \u003e\u003e OK](https://raw.githubusercontent.com/gtesei/Patterns_for_Continuous_Integration_Docker_Jenkins/master/img/jen_pip.PNG)\n\n#### Pipeline \u003e\u003e Pipeline Script from SCM \u003e\u003e Git \u003e\u003e Enter Git URL \u003e\u003e Save \n\n![Pipeline \u003e\u003e Pipeline Script from SCM \u003e\u003e Git](https://raw.githubusercontent.com/gtesei/Patterns_for_Continuous_Integration_Docker_Jenkins/master/img/jen_pip2.PNG)\n\n## Jenkinsfile\n\n```groovy\npipeline {\n  agent none\n  stages {\n    stage('install-build-test-coveralls') {\n      agent {\n        docker {\n          image 'python:3.6.1'\n          args '-u root:sudo'\n        }\n      }\n      environment {\n        COVERALLS_REPO_TOKEN = credentials('d79070bd-2e2b-4a91-ba27-e1ecd68897ad')\n      }\n\n      steps {\n        /*** INSTALL ***/\n        sh \"python --version\"\n        sh \"pip install --upgrade pip\"\n        sh \"pip install -r requirements-dev.txt\"\n        sh \"pip install pytest pytest-cov\"\n        sh \"pip install coveralls\"\n        sh \"pip install coverage\"\n\n        /*** BUILD ***/\n        sh \"pip install -e .\"\n\n        /*** TEST ***/\n        sh \"py.test --doctest-modules --cov\"\n\n        /*** COVERALLS ***/\n         sh \"echo $COVERALLS_REPO_TOKEN\"\n        /* sh \"coverage run setup.py test\" */\n        sh \"py.test --doctest-modules --cov\"\n        sh \"coverage report -m\"\n        sh \"COVERALLS_REPO_TOKEN=$COVERALLS_REPO_TOKEN_PSW coveralls\"\n      }\n\n    }\n\n    stage('docker') {\n      agent any\n      environment {\n        IMAGE_NAME = 'gtesei/hello_docker_jenkins'\n        DOCKER_REGISTRY = credentials('3897e886-55e9-491f-95f9-bf0280b72966')\n      }\n      steps {\n        sh \"docker pull $IMAGE_NAME || true\"\n        sh 'docker build --pull --cache-from \"${IMAGE_NAME}:develop\" --tag \"$IMAGE_NAME\" . || true'\n        sh 'docker login -u $DOCKER_REGISTRY_USR -p $DOCKER_REGISTRY_PSW'\n        sh 'docker tag $IMAGE_NAME \"${IMAGE_NAME}:develop\"'\n        sh 'docker push \"${IMAGE_NAME}:develop\"'\n      }\n    }\n\n  }\n}\n\n```\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgtesei%2Fpatterns_for_continuous_integration_docker_jenkins","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fgtesei%2Fpatterns_for_continuous_integration_docker_jenkins","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgtesei%2Fpatterns_for_continuous_integration_docker_jenkins/lists"}