PORT
environment variable. You do not need to define it yourself or hard-code it into the application. For example, in Node.js, use process.env.PORT
in your code when referring to the server port.
Detailed information about how to create a Dockerfile is available in Docker Docs.
To use the Web Terminal with an application created with a Dockerfile, make sure Bash is installed in the container. In most cases, the base image (e.g. Ubuntu) includes a shell package and will work by default. In some more streamlined containers, the shell package may not be included, and you’ll need to add it. The base image determines how to add the shell package:Alpine: apk add bashUbuntu/Debian: apt install bashFedora: dnf install bash
Dockerfile settings
To use a Dockerfile, you must change the Build environment option in the application’s Settings (Settings > Build > Update settings). The Dockerfile path is the path to your Dockerfile relative to the repository root. For example, if your Dockerfile is in the repository root, enter Dockerfile in that field. If your Dockerfile is in a subdirectory named app, enter the path to the Dockerfile: app/Dockerfile. Context is the path in the repository we need access to so we can build your application. Most applications are built from the repository root, and you can enter the repository root (.) in the Context field. If your application needs to be built from a subdirectory (e.g. app), enter that subdirectory path in the Context field: app. The Registry credential is only required for private Docker images. You must enter your registry credentials within username > Company settings > Registry credentials. Once you’ve entered your credentials in the Company settings, you can choose which credentials you want to use.Dockerfile and pnpm
If you use pnpm with a Dockerfile, you must use the following location forPNPM_HOME
: