Sign In
Sign In

Deploy with a Dockerfile

Updated on 14 May 2024

Using Dockerfile, you can deploy any application on the App platform regardless of the framework used to build the app.

Requirements

  • For the deployment to run without issues, you must place the Dockerfile in the root directory of the repository. The Dockerfile should contain all the necessary instructions for building and running the application. 

  • You must specify the EXPOSE parameter in the Dockerfile so that Hostman can determine which port Nginx should listen on. If EXPOSE is not set, Nginx will listen on container port 8080 by default.

Example:

FROM python:3.6

MAINTAINER Name Name "[email protected]"

COPY . /app

WORKDIR /app

RUN pip install -r requirements.txt

ENTRYPOINT ["python"]

CMD ["app.py"]

EXPOSE 3478

  • Docker-compose is not supported.

  • You can set environment variables in the Dockerfile or in the Hostman dashboard when creating a new app.

Step 1. Select the application type

  1. Go to the App platform section and click Create.

  2. Select the Dockerfile tab.

8edc8c0f Cb05 4626 8623 E82bb8b5b3e2

Step 2. Connect a repository

Select the repository with the application. The Dockerfile must be placed at the root of the repository.

You can connect a repository:

  • From your GitHub, GitLab, or BitBucket account. Click on the platform name, log in and select the desired repository. If you are already logged in, Hostman will immediately show the available repositories.

  • By URL, providing a link to a repository created on any platform. Click Connect the repository via URL and enter the Git URL of the repository. If the repository is private, also enter the access details.

Read more about connecting repositories here.

Step 3. Select a branch and commit

Select a branch for deployment.

By default, we enable the Build by the last executed commit option. In this case, the App platform will deploy the latest commit, and later will automatically rebuild the application when you add new commits to the repository. If necessary, you can disable automatic deployment in the future.

If you want to select a specific commit manually, disable this option.

Step 4. Select server location and configuration

Your application must run on a separate cloud server. Select the region where the server should be located and its configuration.

You can always upgrade your server later, however, downgrading will not be possible.

Step 5: Configure the build settings

The App Platform will read the parameters set in the Dockerfile and build the application accordingly.

At this point you can set variables if necessary. If they are written in the Dockerfile, there is no need to duplicate them.

Later on, you will be able to change any of these settings, as well as select a different branch and commit, and restart the deployment with new settings, if necessary.

Step 6: Enter the app information

Here you can specify a name and a comment for your application to be displayed in the Hostman dashboard. You can also select a project to add the app to.

These settings can also be changed later.

Step 7. Deploy

Click Start Deploy. Once the process starts, you will see the deployment log on the Deploy tab.

The deploy log contains all the necessary information to solve possible issues. If something goes wrong, for example, due to errors in the code, the deploy log will display the notification about it specifying the cause of the problem.

When you first deploy a project, the server installation may take some time. Once the process is completed, the application status will be updated, and you will also see a message about this in the log.

All done!

You can find the application's IP address and the technical domain linked to the app in the Dashboard tab. To link your own domain to the app, follow this guide.

The application runs on ports 80 and 443.

In the future, the App platform will monitor updates in the repository and, if automatic deployment is enabled, automatically rebuild the project with new changes.

Was this page helpful?
Updated on 14 May 2024

Do you have questions,
comments, or concerns?

Our professionals are available to assist you at any moment,
whether you need help or are just unsure of where to start.
Email us
Hostman's Support