We will create a custom Dockerfile and assign the Heroku $ PORT environment variable to the restheart HTTP_PORT environment variable.
Restheart : github.com/SoftInstigate/restheart
Running insctructions with Docker : hub.docker.com/r/softinstigate/restheart
FROM adoptopenjdk:16-jre-hotspotLABEL maintainer="SoftInstigate <info@softinstigate.com>"
WORKDIR /opt/restheart
COPY etc/restheart.yml etc/default.properties etc/acl.yml etc/users.yml etc/
COPY target/restheart.jar /opt/restheart/
COPY target/plugins/* /opt/restheart/plugins/
ENTRYPOINT [ "java", "-Dfile.encoding=UTF-8", "-server", "-jar", "restheart.jar", "etc/restheart.yml"]
CMD ["--envFile", "etc/default.properties"]
EXPOSE 8009 8080 4443
Dockerfile updated :
The important line here is :
ENTRYPOINT [“java”,"-DHTTP_PORT=$PORT",
“-Dfile.encoding=UTF-8”, “-server”, “-jar”, “restheart.jar”, “etc/restheart.yml”].
# <https://github.com/SoftInstigate/restheart>
FROM softinstigate/restheart:6.1.2
ENTRYPOINT ["java","-DHTTP_PORT=$PORT", "-Dfile.encoding=UTF-8", "-server", "-jar", "restheart.jar", "etc/restheart.yml"]
CMD [ "--envFile", "etc/default.properties"]
COPY /restheart.yml /opt/restheart/etc/restheart.yml
COPY /default.properties /opt/restheart/etc/default.properties
COPY /acl.yml /opt/restheart/etc/acl.yml
COPY /users.yml /opt/restheart/etc/users.yml
Other environment variables like MONGO_URI
can be configured in Dashboard> Settings> Config Vars.
Now you can follow the heroku tutorial to deploy with Docker : devcenter.heroku.com/categories/deploying-with-docker