feat: write auto-detected port mappings during a deploy

During an app build, we now auto-detect ports based on the source code. This is usually http:80:5000, with Dockerfile-based deploys having their ports extracted from the docker image or Dockerfile. Additionally, we add an https:443 mapping for any detected http:80 mapping when there is an ssl certificate, and all http port mappings are transformed to https mappings for Dockerfile-based deploys.

While the ports aren't currently consumed, a future refactor will provide the ability to fallback to the new detected ports when there is no user-specified port mapping.
This commit is contained in:
Jose Diaz-Gonzalez
2023-07-16 03:35:40 -04:00
parent b44be8def9
commit 4bc3de5540
16 changed files with 246 additions and 10 deletions

View File

@@ -35,6 +35,7 @@ trigger-builder-pack-builder-build() {
pack build "$IMAGE" --builder "$DOKKU_CNB_BUILDER" --path "$SOURCECODE_WORK_DIR" --default-process web "${ENV_ARGS[@]}"
docker-image-labeler --label=dokku --label=org.label-schema.schema-version=1.0 --label=org.label-schema.vendor=dokku --label=com.dokku.image-stage=build --label=com.dokku.builder-type=pack --label=com.dokku.app-name=$APP "$IMAGE"
plugn trigger ports-set-detected "$APP" "http:80:5000"
plugn trigger post-build-pack "$APP" "$SOURCECODE_WORK_DIR"
}