0

This post is related to this but none of the solutions worked.

Context

I am trying to run a Scala application using the Play Framework in production using Docker. Running the container throws a Bad root server path: /opt/docker/-Dconfig.resource=/opt/docker/conf/production.conf and stops.

Steps to build and run the docker container:

  1. build.sbt
...
Docker / version := sys.env.getOrElse("BUILD_NUMBER", "0")
Docker / daemonUserUid  := None
Docker / daemonUser := "daemon"
dockerExposedPorts := Seq(9000)
dockerBaseImage := "openjdk:8-jre-alpine"
dockerUpdateLatest := true
dockerEntrypoint := Seq("/opt/docker/bin/play-scala-seed", "-Dconfig.resource=/opt/docker/conf/production.conf")
  1. sbt "Docker / publishLocal" Produces the following Dockerfile:
FROM openjdk:8-jre-alpine
LABEL MAINTAINER="[email protected]
WORKDIR /opt/docker
COPY --chown=daemon:root opt /opt
EXPOSE 9000
USER daemon
ENTRYPOINT ["/opt/docker/bin/play-scala-seed", "-Dconfig.resource=/opt/docker/conf/production.conf"]
CMD []
  1. docker run --rm -p 9000:9000 playground-api
/opt/docker/bin/play-scala-seed: line 99: is_cygwin: not found
Bad root server path: /opt/docker/-Dconfig.resource=/opt/docker/conf/production.conf

As per this link one can ignore the is_cygwin error message.

What I've tried:

  1. Changing the dockerEntrypoint from the build.sbt file to "-Dconfig.resource=/conf/production.conf" or "-Dconfig.resource=production.conf"

  2. Putting the -Dconfig.resource to the docker run command: docker run ... playground-api -Dconfig.resource=./conf/production.conf

Setup:

sbt 1.7.2, Play Version 2.8.19, Java 1.8.0_362, Ubuntu 22.04.2 LTS

Any help is appreciated, thanks!

1 Answer 1

0

You don't need to put opt/docket in your path as play already knows it. If following example don't work try to remove ./ at the beginning.

dockerEntrypoint := Seq("./bin/play-scala-seed", "-Dconfig.resource=/opt/docker/conf/production.conf")
1
  • Thank you for your answer. I am afraid this does not work for me - it is still throwing the exact same error message when running the docker container (after rebuilding the image with the changes you proposed)
    – edge
    Commented May 14, 2023 at 11:04

Not the answer you're looking for? Browse other questions tagged or ask your own question.