We already have a Dockerfile present in the repository but there is problem in many lines of code.I studied about Docker and learned how It is deployed and I am now going to explain how I deployed BadgeYaY on Docker Cloud.
To make deploying of Badgeyay easier we are now supporting Docker based installation.
Before we start to deploy, let’s have a quick brief about what is docker and how it works ?
What is Docker ?
Docker is an open-source technology that allows you create, deploy, and run applications using containers. Docker allows you deploy technologies with many underlying components that must be installed and configured in a single, containerized instance.Docker makes it easier to create and deploy applications in an isolated environment.
Now, let’s start with how to deploy on docker cloud:
Step 1 – Installing Docker
Get the latest version of docker. See the offical site for installation info for your platform.
Step 2 – Create Dockerfile
With Docker, we can just grab a portable Python runtime as an image, no installation necessary. Then, our build can include the base Python image right alongside our app code, ensuring that our app, its dependencies, and the runtime, all travel together.
These portable images are defined by something called a Dockerfile.
In DockerFile, there are all the commands a user could call on the command line to assemble an image. Here’s is the Dockerfile of BadgeYaY.
Step 3 – Build New Docker Image
When the command completed successfully, we can check the new image with the docker command below:
Step 4 – Run the app
Let’s run the app in the background, in detached mode:
We get the long container ID for our app and then are kicked back to our terminal.Our container is running in the background.Now use docker container stop to end the process, using the CONTAINER ID, like so :
Step 5 – Publish the app.
Log in to the Docker public registry on your local machine.
Upload your tagged image to the repository:
From now on, we can use docker run and run our app on any machine. No matter where docker run executes, it pulls your image, along with Python and all the dependencies from requirements.txt, and runs your code. It all travels together in a neat little package, and the host machine doesn’t have to install anything but Docker to run it.
Docker Cloud provides a hosted registry service with build and testing facilities for Dockerized application images; tools to help you set up and manage host infrastructure; and application lifecycle features to automate deploying (and redeploying) services created from images.
In BadgeYaY, we also have a Deploy button button which directly deploys on Docker cloud with a single click .
The related PR of this work is https://github.com/fossasia/badgeyay/pull/401 .