Introduction

The recommended way to build the production version of your Latitude project is as a Docker container. This approach is useful if you want to deploy your app on your own infrastructure or you want to use one of the many Docker-based PaaS providers as your deployment target.

Docker container

You will need the Docker CLI installed in your machine.

Every Latitude project is equipped with a Dockerfile to facilitate containerization. To build the Docker container for your Latitude project, proceed as you would with any other Docker project:

docker build . -t my-latitude-app

Once the build is complete, you can test your app locally with:

docker run -p 3000:3000 my-latitude-app

See the docker build documentation for more details.

Environment variables in production builds

Keep in mind .env variables are not available in production builds for security reasons – you should use environment variables instead. You can set them in the Dockerfile or pass them as arguments when running the container. For example, if you had a .env file with the following content:

LATITUDE__DB_PASSWORD=mypassword

You could pass the environment variable to the container like this:

docker run -p 3000:3000 -e LATITUDE__DB_PASSWORD=mypassword my-latitude-app