Play Framework 2.5 in production: "invalid server root path"

I would like to use a prod.conf file to build inside a Docker container. I added this to my Dockerfile:

ENTRYPOINT ["bin/myapp", "-D", "config.resource=prod.conf"]

      

But I got this error:

Bad root server path: /opt/docker/-D

      

I am getting the same error when I try to run the command manually with root

/opt/docker/bin/myapp -D config.resource=prod.conf

      

If I run

/opt/docker/bin/myapp

      

It works, but uses the default application.conf file.

I think there is no permission.

Here is my complete Dockerfile:

FROM openjdk:8u121-alpine
WORKDIR /opt/docker
ADD opt /opt
RUN ["chown", "-R", "daemon:daemon", "."]
EXPOSE 9000
USER daemon
ENTRYPOINT ["bin/myapp", "-D", "config.resource=prod.conf"]
CMD []

      

Edit:

I got the same error locally:

activator clean stage
target/universal/stage/bin/myapp -D config.resource=prod.conf
Bad root server path: /home/me/Documents/MyApp-D

      

+3


source to share


2 answers


There -D

must be no spaces between and the configuration value. Use this instead:



ENTRYPOINT ["bin/myapp", "-Dconfig.resource=prod.conf"]

      

+1


source


If you are using the sbt "DockerPlugin" plugin you can enter

dockerEntrypoint := Seq("")

in the build.sbt file. This will cause

ENTRYPOINT [""]

      

in your Dockerfile. So then you start docker with your image, you have to specify in the start command the following



bin/myapp "-Dconfig.resource=prod.conf"

      

i.e.

Docker runs YOUR_DOCKER_IMAGE bin / myapp "-Dconfig.resource = prod.conf"

Note the quotes in -D

0


source







All Articles