refactor: only use detected port mapping if override is not specified

Previously, we would always set the port mapping during a dockerfile build, making it difficult for users to override mappings. We also only _sometimes_ updated the detected port mapping, further confusing issues when users were migrating from Dockerfile to Buildpacks for builds.

Now, we always detect the port mapping during the build process, and only use that detected port mapping if an override is not specified. This greatly simplifies the experience around port mapping, as now a user can create an app, set a port mapping, and that first deploy will respect the port mapping without an additional deploy.

The builder always has the best context for what the app should be listening on, and thus we can always specify a "default" port mapping at this stage. Users can override this map as desired later.

This change also results in the removal of a ton of internal code that is now centralized in the ports plugin.

Closes #4067
This commit is contained in:
Jose Diaz-Gonzalez committed 2023-08-05 10:58:57 -04:00
1 parent 6168b0c71c
commit f8ccf52079
36 files changed
+238 -416

No files matched your search

-26
View File
@@ -46,32 +46,6 @@ teardown() {
docker rm $RANDOM_RUN_CID
}
@test "(core) port exposure (dockerfile raw port)" {
source "$PLUGIN_CORE_AVAILABLE_PATH/common/functions"
cat <<EOF >$DOCKERFILE
EXPOSE 3001/udp
EXPOSE 3003
EXPOSE 3000/tcp
EOF
run get_dockerfile_exposed_ports $DOCKERFILE
echo "output: $output"
echo "status: $status"
assert_output "3001/udp 3003 3000/tcp"
}
@test "(core) port exposure (dockerfile tcp port)" {
source "$PLUGIN_CORE_AVAILABLE_PATH/common/functions"
cat <<EOF >$DOCKERFILE
EXPOSE 3001/udp
EXPOSE 3000/tcp
EXPOSE 3003
EOF
run get_dockerfile_exposed_ports $DOCKERFILE
echo "output: $output"
echo "status: $status"
assert_output "3001/udp 3000/tcp 3003"
}
@test "(core) image type detection (herokuish default user)" {
run deploy_app
echo "output: $output"