Reference
Docker

Docker Example

Flightcontrol works well with Docker and Dockerfiles, but we also encourage you to consider using Nixpacks as a build type. Nixpacks automatically detect the type of service you are deploying, so you do not have to setup a Dockerfile.

Below is an example flightcontrol.json file showing a Docker deployment that authenticates to the Docker Hub.

Important Note for Docker Images

Please note, while using custom docker images, you will get build errors related to Docker Hub unauthenticated pull limit toomanyrequests: You have reached your pull rate limit. You may increase the limit by authenticating and upgrading: [https://www.docker.com/increase-rate-limit](https://www.docker.com/increase-rate-limit), there are couple of workarounds:

  1. Use AWS Elastic Container Registry (ECR) public images instead of using Docker Hub, ECR will support unlimited free pulls within AWS resources
  2. If you have a Docker hub account, you can use DOCKER_USERNAME and DOCKER_PASSWORD environment variables, and Flightcontrol will authenticate the pull request automatically for you.

Configuration as Code

There are two ways to configure your deployment with Flightcontrol - the dashboard and with a configuration file.

Below is an example of a configuration file for a Docker deployment. This flightcontrol.json file also shows how to use the Docker Hub username and password environment variables to avoid the Docker Hub pull rate limits.

flightcontrol.json
{
  "environments": [
    {
      "id": "production",
      "name": "Production",
      "region": "us-west-2",
      "source": {
        "branch": "main"
      },
      "services": [
        {
          "id": "my-webapp",
          "name": "My Webapp",
          "type": "fargate",
          "dockerfilePath": "Dockerfile",
          "dockerContext": ".",
          "cpu": 0.25,
          "memory": 0.5,
          "port": 8080,
          "minInstances": 1,
          "maxInstances": 1,
          "envVariables": {
            "DATABASE_URL": {
              "fromService": {
                "id": "db",
                "value": "dbConnectionString"
              }
            },
            "DOCKER_USERNAME": {
              "fromParameterStore": "docker.hub.username"
            },
            "DOCKER_PASSWORD": {
              "fromParameterStore": "docker.hub.password"
            }
          }
        },
        {
          "id": "db",
          "name": "Database",
          "type": "rds",
          "engine": "postgres",
          "engineVersion": "12",
          "instanceSize": "db.t4g.micro",
          "storage": 20,
          "private": false
        }
      ]
    }
  ]
}