Giter Club home page Giter Club logo

docker-flask-demo's Introduction

Docker-Flask-Demo

Building a python-flask app image with Docker and pushing to Dockerhub using Jenkins CI/CD

docker-flask-demo(2)

To run/test the app manually on an ubuntu/debian server:

To containerize the app using Docker:

  • Install Docker
  • $ cd docker-flask-demo
  • $ docker build -t flask-app . (to build image)
  • $ docker run -d -p 8080:8080 flask-app (to run container)
  • $ docker stop 'container-ID' (to stop container)

To containerize & push app to Dockerhub with Jenkins:

  • Install Jenkins on same server. See installation guide here
  • On the Jenkins U.I, go to Manage Jenkins -> Credentials -> global -> Add Credentials :
    • Kind = ‘username & password’-> Enter your dockerhub account's username & password respectively
    • Id = ‘dockerhub’
    • Description = ‘dockerhub_credentials’. Save.
  • Go to dashboard & create new item (pipeline project) -> Advanced Project Options -> Advanced -> Display Name = ‘Docker-Flask-App’
  • Pipeline -> Pipeline SCM (enter github repo details). Save.
  • Go to Manage Jenkins -> Manage Plugins -> Install ‘safe restart’ plugin
  • On the server's command line:
  • $ sudo usermod -a -G docker Jenkins. Log out & Log back in (to give Jenkins access to Docker)
  • Restart Jenkins using systemctl on the command line OR via the U.I using 'safe restart'
  • Build project
  • Check Dockerhub to confirm that image was pushed successfully

Note:

  • Edit the image name on the Jenkinsfile to your preference

docker-flask-demo's People

Contributors

lily-g1 avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.