我有一个通过sbt run命令在Docker(2.0.0.3)容器上运行的Play应用程序,用于开发目的。
启动时,似乎由于某种原因多次重新加载(编译)了应用程序,而这在迁移到Docker之前从未发生过。
即使仅修改单个文件,也会自动触发重新加载 (应用程序不等待新的重新加载请求)
↓启动时应用程序的输出。
Listening for transport dt_socket at address: 9999
[info] Loading global plugins from /root/.sbt/1.0/plugins
[info] Loading settings for project project-build from plugins.sbt ...
[info] Loading project definition from /root/path/to/project
[info] Loading settings for project root from build.sbt ...
[info] Resolving key references (33083 settings) ...
[info] Set current project to ProjecRoot (in build file:/path/to/base/)
[info] Updating dependentApp1...
[info] Updating dependentApp2...
[info] Updating dependentApp3...
[info] Updating dependentApp4...
[info] Done updating.
[warn] There may be incompatibilities among your library dependencies.
[warn] Run 'evicted' to see detailed eviction warnings
[info] Updating dependentApp5...
[info] Done updating.
[warn] There may be incompatibilities among your library dependencies.
[warn] Run 'evicted' to see detailed eviction warnings
[info] Updating dependentApp6...
[info] Done updating.
[warn] There may be incompatibilities among your library dependencies.
[warn] Run 'evicted' to see detailed eviction warnings
[info] Done updating.
[warn] There may be incompatibilities among your library dependencies.
[warn] Run 'evicted' to see detailed eviction warnings
[info] Done updating.
[warn] There may be incompatibilities among your library dependencies.
[warn] Run 'evicted' to see detailed eviction warnings
[info] Updating dependentApp7...
[info] Done updating.
[warn] There may be incompatibilities among your library dependencies.
[warn] Run 'evicted' to see detailed eviction warnings
[info] Done updating.
[warn] There may be incompatibilities among your library dependencies.
[warn] Run 'evicted' to see detailed eviction warnings
[info] Updating dependentApp8...
[info] Updating dependentApp9...
[info] Done updating.
[warn] There may be incompatibilities among your library dependencies.
[warn] Run 'evicted' to see detailed eviction warnings
[info] Done updating.
[warn] There may be incompatibilities among your library dependencies.
[warn] Run 'evicted' to see detailed eviction warnings
[info] Updating dependentApp10...
[info] Updating dependentApp11...
[info] Done updating.
[warn] There may be incompatibilities among your library dependencies.
[warn] Run 'evicted' to see detailed eviction warnings
[info] Done updating.
[warn] There may be incompatibilities among your library dependencies.
[warn] Run 'evicted' to see detailed eviction warnings
[info] Updating dependentApp12...
[info] Done updating.
[warn] There may be incompatibilities among your library dependencies.
[warn] Run 'evicted' to see detailed eviction warnings
[info] Updating dependentApp13...
[info] Done updating.
[warn] There may be incompatibilities among your library dependencies.
[warn] Run 'evicted' to see detailed eviction warnings
[info] Updating dependentApp14...
[info] Done updating.
[warn] There may be incompatibilities among your library dependencies.
[warn] Run 'evicted' to see detailed eviction warnings
--- (Running the application, auto-reloading is enabled) ---
[info] p.c.s.AkkaHttpServer - Listening for HTTP on /0.0.0.0:9000
(Server started, use Enter to stop and go back to the console...)
[info] Updating dependentApp1...
[info] Updating dependentApp2...
[info] Done updating.
[warn] There may be incompatibilities among your library dependencies.
[warn] Run 'evicted' to see detailed eviction warnings
[info] Updating dependentApp3...
[info] Updating dependentApp4...
[info] Done updating.
[warn] There may be incompatibilities among your library dependencies.
[warn] Run 'evicted' to see detailed eviction warnings
[info] Updating dependentApp5...
[info] Done updating.
[warn] There may be incompatibilities among your library dependencies.
[warn] Run 'evicted' to see detailed eviction warnings
[info] Done updating.
[warn] There may be incompatibilities among your library dependencies.
[warn] Run 'evicted' to see detailed eviction warnings
[info] Done updating.
[warn] There may be incompatibilities among your library dependencies.
[warn] Run 'evicted' to see detailed eviction warnings
[info] Updating dependentApp7...
[info] Updating dependentApp6...
[info] Done updating.
[warn] There may be incompatibilities among your library dependencies.
[warn] Run 'evicted' to see detailed eviction warnings
[info] Updating dependentApp8...
[info] Updating dependentApp9...
[info] Done updating.
[warn] There may be incompatibilities among your library dependencies.
[warn] Run 'evicted' to see detailed eviction warnings
[info] Done updating.
[warn] There may be incompatibilities among your library dependencies.
[warn] Run 'evicted' to see detailed eviction warnings
[info] Updating dependentApp11...
[info] Updating dependentApp10...
[info] Done updating.
[warn] There may be incompatibilities among your library dependencies.
[warn] Run 'evicted' to see detailed eviction warnings
[info] Done updating.
[warn] There may be incompatibilities among your library dependencies.
[warn] Run 'evicted' to see detailed eviction warnings
[info] Done updating.
[warn] There may be incompatibilities among your library dependencies.
[warn] Run 'evicted' to see detailed eviction warnings
[info] Updating dependentApp12...
[info] Done updating.
[warn] There may be incompatibilities among your library dependencies.
[warn] Run 'evicted' to see detailed eviction warnings
[info] Updating dependentApp13...
[info] Done updating.
[warn] There may be incompatibilities among your library dependencies.
[warn] Run 'evicted' to see detailed eviction warnings
[info] Updating dependentApp14...
[info] Done updating.
[warn] There may be incompatibilities among your library dependencies.
[warn] Run 'evicted' to see detailed eviction warnings
[info] Updating dependentApp1...
[info] Updating dependentApp2...
[info] Done updating.
[warn] There may be incompatibilities among your library dependencies.
[warn] Run 'evicted' to see detailed eviction warnings
[info] Updating dependentApp3...
[info] Updating dependentApp4...
[info] Done updating.
[warn] There may be incompatibilities among your library dependencies.
[warn] Run 'evicted' to see detailed eviction warnings
[info] Updating dependentApp5...
[info] Updating dependentApp6...
[info] Done updating.
[warn] There may be incompatibilities among your library dependencies.
[warn] Run 'evicted' to see detailed eviction warnings
[info] Done updating.
[warn] There may be incompatibilities among your library dependencies.
[warn] Run 'evicted' to see detailed eviction warnings
[info] Done updating.
[warn] There may be incompatibilities among your library dependencies.
[warn] Run 'evicted' to see detailed eviction warnings
[info] Done updating.
[warn] There may be incompatibilities among your library dependencies.
[warn] Run 'evicted' to see detailed eviction warnings
[info] Updating dependentApp7...
[info] Done updating.
[warn] There may be incompatibilities among your library dependencies.
[warn] Run 'evicted' to see detailed eviction warnings
[info] Updating dependentApp8...
[info] Updating dependentApp9...
[info] Done updating.
[warn] There may be incompatibilities among your library dependencies.
[warn] Run 'evicted' to see detailed eviction warnings
[info] Done updating.
[warn] There may be incompatibilities among your library dependencies.
[warn] Run 'evicted' to see detailed eviction warnings
[info] Updating dependentApp10...
[info] Updating dependentApp11...
[info] Done updating.
[warn] There may be incompatibilities among your library dependencies.
[warn] Run 'evicted' to see detailed eviction warnings
[info] Done updating.
[warn] There may be incompatibilities among your library dependencies.
[warn] Run 'evicted' to see detailed eviction warnings
[info] Updating dependentApp12...
[info] Done updating.
[warn] There may be incompatibilities among your library dependencies.
[warn] Run 'evicted' to see detailed eviction warnings
[info] Updating dependentApp13...
[info] Done updating.
[warn] There may be incompatibilities among your library dependencies.
[warn] Run 'evicted' to see detailed eviction warnings
[info] Updating dependentApp14...
[info] Done updating.
[warn] There may be incompatibilities among your library dependencies.
[warn] Run 'evicted' to see detailed eviction warnings
主机的 src 安装在容器的 / root / path / to / base
然后sbt projectNmae/run
被执行为容器的入口点。
↓应用程序的docker-compose文件
version: "3.7"
services:
service-name:
working_dir: /path/to/base
ports:
- "9000:9000"
- "9999:9999"
environment:
JAVA_XMX: 2G
JAVA_XSS: 2M
SBT_OPTS: "-XX:MetaspaceSize=2g -XX:MaxMetaspaceSize=2g"
entrypoint: >
sh -c 'sbt projectName/run -J-Dhttp.port=$${PORT} -J-Dconfig.file=$${CONFIG_FILE} -J-Dlogger.file=$${LOGGER_FILE} -jvm-debug 9999'
volumes:
- ../../src:/root/src
- ../../.ivy2:/root/.ivy2
- ../../.sbt:/root/.sbt
stdin_open: true