diff --git a/CHANGELOG.md b/CHANGELOG.md index 8621898..3785e72 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,12 @@ CHANGELOG GEOIP-API =================== +Unreleased +---------- + +* Respect optional `PORT` environment variable for the HTTP listen port + (defaults to `8080`), for platforms such as Dokku. + 2023-01 (2022-12-31) ------------------- diff --git a/Dockerfile b/Dockerfile index 1727922..ba67309 100644 --- a/Dockerfile +++ b/Dockerfile @@ -47,6 +47,6 @@ COPY --from=builder "/build/GeoLite2-ASN.mmdb" /srv/GeoLite2-ASN.mmdb ENV CITY_DB_FILE /srv/GeoLite2-City.mmdb ENV ASN_DB_FILE /srv/GeoLite2-ASN.mmdb -HEALTHCHECK --interval=5s --timeout=1s CMD curl -f http://localhost:8080/actuator/health +HEALTHCHECK --interval=5s --timeout=1s CMD curl -f http://localhost:${PORT:-8080}/actuator/health EXPOSE 8080 CMD exec /srv/geoip-api diff --git a/README.md b/README.md index 18913a8..d3db324 100644 --- a/README.md +++ b/README.md @@ -51,6 +51,7 @@ variables: | Variable | Description | Default value | | -------- | ----------- | ------------- | +| PORT | HTTP port the service listens on (used by platforms such as Dokku). | `8080` | | CITY_DB_FILE | The location of the GeoIP2 City or GeoLite2 database file. | `/srv/GeoLite2-City.mmdb` | | ASN_DB_FILE | The location of the GeoIP2 ASN database file. | `/srv/GeoLite2-ASN.mmdb` | | ISP_DB_FILE | The location of the GeoIP2 ISP database file. | (none) | diff --git a/src/main/resources/application.yml b/src/main/resources/application.yml index d2b5dc4..d631057 100644 --- a/src/main/resources/application.yml +++ b/src/main/resources/application.yml @@ -1,2 +1,5 @@ spring.main.banner-mode: "off" management.endpoints.web.exposure.include: health, prometheus + +# Honor PORT when set by platforms such as Dokku/Heroku; default to 8080. +server.port: ${PORT:8080}