Code Monkey home page Code Monkey logo

my-tweet-app-docker's Introduction

my-tweet-app-docker

alt text

Docker demo example application

For what is this repository?

This application is designed to show how easy it is to build a Docker image and scan it with Docker Scout using GitHub Actions.

It is using a simple Docker container image based on Alpine, Python and Flask as components that have some vulnerabilities.

We are going to build a new Docker image and compare it with our production image.

Docker Scout will tell us if the new image complies with our security requirements.

The production image is stored in DockerHub: index.docker.io/jeromebaude/my-tweet-app-docker:production

How can you use it?

To be able to use it you must have:

  1. A Github account that you can use to fork this repository
  2. Installation of Visual Studio Code on your local machine
  3. Docker Desktop
  4. A DockerHub account with Docker Scout enabled

Build your image locally

Please update your Dockerfile with Dockerfile.vuln content and ./app/requirements.txt with ./app/requirements.txt.vuln content

Run the following commands:

docker build -t jeromebaude/my-tweet-app-docker:v1 .

Run your image locally

Run the following commands:

docker run -d -p 5000:5000  jeromebaude/my-tweet-app-docker:v1

Check that http://localhost:5000 renders the desire look and feel

Check your image vulnerabilities

Check the vulnerabilities of your newly built image

 docker scout quickview

Compare the new image vulnerabilities with your production image

 docker scout compare --to jeromebaude/my-tweet-app-docker:production jeromebaude/my-tweet-app-docker:v1

Push your changes to your remote GitHub repo and run GitHub Actions

The Github Actions tasks defined inside docker.yml will be auto started as soon as you commit anything to your new Github repository. However to get it up and running you need to configure the following secrets inside your Github repository (Settings > Secrets):

  • REGISTRY_USER: Your Dockerhub Username
  • REGISTRY_TOKEN: Your Dockerhub access token

Commit and push changes to the remote repo:

 git add Dockerfile ./app/requirements.txt
 git commit -m "updating my Docker image to be built"
 git push

You can check your GitHub Action Workflow and adapt it according to your needs.

Clean your environment

 docker rm -f $(docker ps -a -q)
 cp ./app/requirements.txt.vuln ./app/requirements.txt
 cp Dockerfile.vuln Dockerfile 

my-tweet-app-docker's People

Contributors

automatecloud avatar jeromebaude avatar iacbot[bot] 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.