10000 GitHub - Welder90/CICD-Docker-Jenkins
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Welder90/CICD-Docker-Jenkins

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

18 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Setting up continuous integration with Jenkins for a Python 3 Flask application with Docker

This repo has been adapted from the following Medium article: Basic CI/CD for Python projects with Docker and Jenkins and fixed using the work-around posted in the Medium article: Jenkins+Python 3.6 Alpine Docker Image.

This repo is a reference/guide to the steps needed for getting a successful build on Jenkins with Python 3.

Part 0 - Set up Docker

Part 1 - Build a customised docker image of Jenkins with Dockerfile

  • Create a folder with a name of your choice, I chose to create a folder called ./ci-cd-docker-jenkins/, and added a Dockerfile with the following contents:

Dockerfile

FROM jenkins/jenkins:lts-alpine
USER root

# Install Python3 here 
RUN apk add --no-cache python3 && \
      python3 -m ensurepip && \
      pip3 install --upgrade pip setuptools && \
      if [ ! -e /usr/bin/pip ]; then ln -s pip3 /usr/bin/pip ; fi && \
      if [[ ! -e /usr/bin/python ]]; then ln -sf /usr/bin/python3 /usr/bin/python; fi && \
      rm -r /root/.cache

RUN apk add pkgconf
RUN apk add build-base
RUN apk add python3-dev

RUN mkdir /my_app
WORKDIR /my_app
COPY requirements.txt /my_app
RUN pwd
RUN ls -la
  • Build docker image using the following command:

    docker build -t “jenkins:test” path/to/repo

Jenkins build

In Jenkins build -> execute shell textbox command, enter:

echo 'Start installing dependencies'

#!/bin/bash
pip install -r /my_app/requirements.txt

echo 'Start running test cases'
python -m unittest -v tests/test_hello_world

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published
0