The question is quite old now, but still I will write my answer here if it can be of some help to others.
I have spring-boot App along with swagger-ui Dockerized and deployed on Heroku.
This is my application.yml looks like:
server:
port: ${PORT:8080}
forward-headers-strategy: framework
servlet:
contextPath: /my-app
springdoc:
swagger-ui:
path: '/swagger-ui.html'
Below is my DockerFile configuration.
FROM maven:3.5-jdk-8 as maven_build
WORKDIR /app
COPY pom.xml .
RUN mvn clean package -Dmaven.main.skip -Dmaven.test.skip && rm -r target
COPY src ./src
RUN mvn package spring-boot:repackage
########run stage########
FROM openjdk:8-jdk-alpine
WORKDIR /app
RUN apk add --no-cache bash
COPY --from=maven_build /app/target/springapp-1.1.1.jar ./
#run the app
# 256m was necessary for me, as I am using free version so Heroku was giving me memory quota limit exception therefore, I restricted the limit to 256m
ENV JAVA_OPTS "-Xmx256m"
ENTRYPOINT ["java","${JAVA_OPTS}", "-jar","-Dserver.port=${PORT}", "springapp-1.1.1.jar"]
The commands I used to create the heroku app:
heroku create
heroku stack:set container
The commands I used to build image and deploy:
docker build -t app-image .
heroku container:push web
heroku container:release web
Finally make sure on Heroku Dashboard the dyno information looks like this:
web java \$\{JAVA_OPTS\} -jar -Dserver.port\=\$\{PORT\} springapp-1.1.1.jar
After all these steps, I was able to access the swagger-ui via
https://testapp.herokuapp.com/my-app/swagger-ui.html