Deploy with a Dockerfile
Using Dockerfile, you can deploy any application on App Platform regardless of the framework used to build the app.
Requirements Copy link
- The Dockerfile can be located either in the repository root or in the directory specified in the Project Directory Path field. The Dockerfile must contain the instructions required to build and run the application.
-
You must specify the
EXPOSEparameter in the Dockerfile so that Hostman can determine which port Nginx should listen on. IfEXPOSEis not set, Nginx will listen on container port 8080 by default.
Example:
FROM python:3.6
MAINTAINER Name Name "mail@mail.com"
COPY . /app
WORKDIR /app
RUN pip install -r requirements.txt
ENTRYPOINT ["python"]
CMD ["app.py"]
EXPOSE 3478-
You can set environment variables in the Dockerfile or in the Hostman dashboard when creating a new app.
Step 1. Connect Your Repository Copy link
You can connect a repository in one of two ways:
From your GitHub, GitLab, or BitBucket account
- Click on the platform name.
- Log in to your account.
- Select the desired repository in your Hostman dashboard.
If you are already logged in, Hostman will immediately show the available repositories. Choose the one you need.
By URL
You can connect any repository from any platform by providing its Git URL.
- Click Connect the repository via URL.
- Enter the Git URL of the repository.
- If the repository is private, also enter the access details.
Read more about connecting repositories here.
Make sure that the Framework field shows the Dockerfile option.
Step 2. Select Branch and Commit Copy link
Branch
Select a branch for deployment.
The menu displays the 200 most recent branches, as well as the default branch (master, main, or default) if the repository is connected via GitHub, GitLab, or Bitbucket.
Commit
Leave the Build by the last executed commit option enabled if you want App Platform to deploy the latest commit and automatically rebuild the application when you add new commits to the repository. You can disable automatic deployment in the future.
If you want to select a specific commit, disable this option. Note that it will also disable automatic deployments.
Step 3. Select Server Region and Configuration Copy link
Region
Your application must run on a separate cloud server. Select the region where the server should be located.
Configuration
Select the server configuration. You can always upgrade your server later, however, downgrading will not be possible.
Step 4. Configure Additional Settings Copy link
Click Show advanced settings to configure additional parameters.
App Platform reads the parameters set in the Dockerfile and builds the application accordingly.
Here you can also add the app to a private network, specify the project directory path, and set up the health check path and environment variables. If the health check or variables are already defined in the Dockerfile, there's no need to duplicate them here.
Private Network
You can add the application to a private network and specify the IP address the app will use.
Apps with a private IP address may experience a short downtime during redeployment, as existing ports need to be freed up before the new version starts.
Project Directory Path
If the Dockerfile is located in the repository root, leave the Project Directory Path field empty.
If the Dockerfile is located in a subdirectory, specify the path to that directory relative to the repository root. This path is used both as the location of the Dockerfile and as the build context.
Health Check Path
App Platform uses the health check path to periodically verify that your application is running and functioning correctly.
See more here.
Environment Variables
Use variables to store and pass configuration values such as passwords, file paths, and tokens.
See more here.
Step 5. Enter the App Information Copy link
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 6. Deploy Copy link
Click Create. 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, App Platform will monitor updates in the repository and, if automatic deployment is enabled, automatically rebuild the project with new changes.