Dockerfile

Dockerfile

If you need more detailed control of the environment that your app runs in, you can select Dockerfile as the framework when you initialize your app. With that, you can specify a Dockerfile in your app directory to build the app.

The Dockerfile needs to EXPOSE the selected port number and use that to serve the app.

If you initialize your app from scratch with the wizard, it will create an example Dockerfile and app that is already set up.

You can deploy your app with the --verbose flag and it will print the Docker build logs to your terminal.

numerous deploy --verbose --app my-app-slug --organization my-organization-slug

Configuring the port number

After initializing the app, the port is stored under the port key in numerous.toml.
It needs to match the port number that is exposed in the Dockerfile with the EXPOSE command.

For example, you may have a numerous.toml with the following docker configuration:

# ...
port = 1234
 
[docker]
context = "."
dockerfile = "Dockerfile"

The Dockerfile should contain and the command should use that port. Here, the built-in http server is launched with the port:

FROM python
 
EXPOSE 1234
 
ENTRYPOINT ["python", "-m", "http.server", "1234"]

Using build arguments in your build

If you need to use build arguments, you can provide them in an .env file in the app directory. These variables will be passed to the build as Docker build arguments.

For example, you may have the .env file:

MY_BUILD_ARG=my-build-arg-value

Which would match the Dockerfile:

FROM python
 
ARG MY_BUILD_ARG
 
RUN echo "We can use the build argument in a RUN statement: ${MY_BUILD_ARG}"
 
# ...

Remember that build arguments are not expanded in the entrypoint command.