When you deploy an application, our build system fetches all the required dependencies according to the programming language and the requirements of your project. For compiled languages, their executable or package is then built. All these files are gathered in an application image. This image is stored and distributed to our servers when they need to run your application. So one consequence is: the lighter the faster.
.slugignore file allows you to list files and directories that should not
be included in the image after the build of your application. When you have heavy
build dependencies, you often don’t need them after the build, so why keep them?
They would only slow down your application’s boot time.
.slugignore file at the root of your project containing on each line
the name of a file or directory you want to exclude from your image.
Your Ruby application doesn’t need to have all its test suites when running
in production, so the
spec folder can be filtered out:
Most Rails applications also use Webpacker to bundle the assets. If this is your case, you can safely remove the following folders that are not necessary to run the application:
Some PHP applications also use Webpack (or Webpack Encore) to bundle the assets. If this is your case, you can safely remove the following folders that are not necessary to run the application:
Your application build process result in a
.war file and you don’t want to keep all the generated
classes and jar archives from the build:
You’re deploying a Go application but you don’t want to keep the Godeps directory containing all the third party dependency source code in the image: