Custom Dockerfile

Building and Deploying with a Custom Dockerfile

Flightcontrol can build an individual service (web server or worker) using a Dockerfile that you provide in the Git repository. This could be useful if your project has complicated build requirements, or if you already have a Dockerfile that you use to build your application.

Custom Dockerfiles are one of three build type options for Flightcontrol - the other two are Nixpacks and using a pre-built Docker image from a registry - such as Docker Hub or Amazon Elastic Container Registry (ECR).

In this guide, we'll walk through the steps to get your project deployed to AWS using a custom Dockerfile.

Prerequisites

You'll need the following before you begin:

Configuring a Web Server Service

To use a custom Dockerfile, start a new project on Flightcontrol and choose your Git repository. You may need to connect your Flightcontrol account to GitHub first.

After creating your project, you'll be able to add an environment (such as production or staging) and a set of services to run.

Start by adding a web server service to your environment.

Add a Web Server service

The Web Server service configuration will appear. The default build type is Nixpacks. Click the build type dropdown and select "Custom Dockerfile".

Choosing the Custom Dockerfile build type

If you're working with a project that uses a different name for the Dockerfile, or you are working with a monorepo and the Dockerfile is in a subdirectory, you can change the name or path of the Dockerfile to use or the Docker context path.

Change the port number to match the port your application listens on. Port 3000 is the default for Flightcontrol, and once you create a service, this can't be changed - you will have to delete and recreate the service.

Choose the rest of the settings on the Web Server service to match your project (such as health check URL, and instance size).

You will also need to select an AWS region for your project, such as us-east-1 or us-west-1. This is where your application will be deployed.

Set any required environment variables for your project if needed.

Deploying the Project with Flightcontrol

Click "Create Project" to start the deployment process.

Flightcontrol will build your project's container image using the Dockerfile you provided. Flightcontrol then deploys your project to AWS ECS Fargate, and creates a load balancer to route traffic to your application.

Automated Flightcontrol Deployments

When your GitHub repository is updated with new commits on the branch that Flightcontrol is watching, Flightcontrol will automatically start another build and deployment process for you. Typically, this would be the main branch, but you can change this in the dashboard.

Next Steps

From this start, you should be able to get your Dockerfile-based project deployed to AWS using Flightcontrol as the build and deployment pipeline.

You can add databases, Redis servers, static sites, or workers to your project as well. Flightcontrol will provision these services for you with AWS.

Troubleshooting

When Flightcontrol builds your application, if there are any errors from the Dockerfile, they will appear in the "Build Logs" for each deployment.

If something fails during your deployment, check the "Deploy Logs" for your deployment. The logs for your application before it fails will be shown here.

With any problems, please contact Flightcontrol support and we will be happy to help you get your project deployed.