Dockerfile Build (Beta)
With Dockerfile builds, Deploio can build any app that can be built using a Dockerfile.
Example App
We have a basic Dockerfile app in our examples repository. You can deploy it with nctl
:
nctl create application dockerfile-rust \
--git-url=https://github.com/ninech/deploio-examples \
--git-sub-path=dockerfile/rust \
--dockerfile
Configuring the Dockerfile to use
By default, the Dockerfile
in your repository root will be used. To use any
other file, you can use the flag --dockerfile-path
to specify a Dockerfile
at a different location.
--dockerfile-path="path/to/Dockerfile"
Configuring the Docker build context
By default, the build context will be set to your repository root. To use
another directory, you can use the flag --dockerfile-build-context
to specify
a different location.
--dockerfile-build-context="path/to/build/context/"
Ensuring your Dockerfile App releases successfully
The Deploio runtime will use the ENTRYPOINT
and CMD
specified in the
Dockerfile to start your application.
To serve traffic to your app, the runtime expects it to listen on a TCP socket at 0.0.0.0:$PORT
. The port defaults to 8080
if not specified but can be
configured to any valid port number in the app definition. The app health will
be checked by a TCP probe to the configured port and traffic only flows to the
app once the probe is successful. If the TCP probe fails at any point of the
lifecycle, the runtime will restart the app. Also if the app exits for any
reason, it will be automatically restarted.
Image Size Recommendation
Images built with Deploio's Dockerfile build should not exceed 2 GiB uncompressed. There's a hard limit at 10 GiB for the whole build environment but with an image size of more than 2 GiB, the system won't be able to cache all the layers anymore and you'll notice degraded building performance.
Best Practices
Any best practices that apply to Dockerfiles in general will also apply to Dockerfile builds on Deploio.
- Try to minimize your image size for faster builds, faster releases and decreased attack surface.
- Use multi-stage builds for compiled languages whenever possible.