Draft: feat: Do not wrap CNB container with EXPOSE 5000
It seems like we do not actually need port 5000 explicitly exposed. Ports can also be exposed at runtime. This is what the containerPort
directive does in Kubernetes.
So why was it there? I think I added it originally because the Herokuish build uses it, and because the services
-based test structure demands an exposed port.
Getting rid of the intermediate cnb.Dockerfile
should speed up the build and paves the way for improved layer caching.
Manual QA
- the build used CNB and succeeded
- the deployment succeeded
- the application responds to requests (edit: I've deleted the cluster now to save money)
-
docker inspect registry.gitlab.com/hfyngvason/example-rails-project/master:latest
shows that no port is exposed on the image
PORT
to 5000
is required
Update: setting the default Turns out that the rails buildpack is a special case in having PORT
set to 5000
by default. Luckily, the new pack
version includes the ability to inject runtime variables through a .profile
script, which I've implemented and think is a reasonable compromise.
Edited by Hordur Freyr Yngvason