SBT 不是来自根目录的 运行
SBT not running from root directory
FROM openjdk:8 as build
ENV SBT_VERSION "1.5.8"
ENV APP_HOME /service
RUN \
apt-get update && \
apt-get install apt-transport-https curl gnupg -yqq && \
echo "deb https://repo.scala-sbt.org/scalasbt/debian all main" | tee /etc/apt/sources.list.d/sbt.list && \
echo "deb https://repo.scala-sbt.org/scalasbt/debian /" | tee /etc/apt/sources.list.d/sbt_old.list && \
curl -sL "https://keyserver.ubuntu.com/pks/lookup?op=get&search=0x2EE0EA64E40A89B84B2DF73499E82A75642AC823" | gpg --no-default-keyring --keyring gnupg-ring:/etc/apt/trusted.gpg.d/scalasbt-release.gpg --import && \
chmod 644 /etc/apt/trusted.gpg.d/scalasbt-release.gpg && \
apt-get update && \
apt-get install sbt=$SBT_VERSION && \
sbt sbtVersion
我收到一条错误消息,提示 E:未找到 'sbt' 的版本“1.5.8”
我不得不将我的工作目录从默认 /
更改为让它工作。尝试下面(WORKDIR
更改文件夹,命令中的 cd
可能具有相同的效果)可以。这为我构建并运行 sbt
命令。
FROM openjdk:8 as build
ENV SBT_VERSION "1.5.8"
ENV APP_HOME /service
WORKDIR $APP_HOME
RUN \
apt-get update && \
apt-get install apt-transport-https curl gnupg -yqq && \
echo "deb https://repo.scala-sbt.org/scalasbt/debian all main" | tee /etc/apt/sources.list.d/sbt.list && \
echo "deb https://repo.scala-sbt.org/scalasbt/debian /" | tee /etc/apt/sources.list.d/sbt_old.list && \
curl -sL "https://keyserver.ubuntu.com/pks/lookup?op=get&search=0x2EE0EA64E40A89B84B2DF73499E82A75642AC823" | gpg --no-default-keyring --keyring gnupg-ring:/etc/apt/trusted.gpg.d/scalasbt-release.gpg --import && \
chmod 644 /etc/apt/trusted.gpg.d/scalasbt-release.gpg && \
apt-get update && \
apt-get install sbt=$SBT_VERSION && \
sbt sbtVersion
root@a94ff4797239:/service# sbt
[info] welcome to sbt 1.5.8 (Oracle Corporation Java 1.8.0_312)
[info] loading project definition from /service/project
[info] set current project to service (in build file:/service/)
[info] sbt server started at local:///root/.sbt/1.0/server/c75bcef1d951ec508da8/sock
[info] started sbt server
sbt:service>
FROM openjdk:8 as build
ENV SBT_VERSION "1.5.8"
ENV APP_HOME /service
RUN \
apt-get update && \
apt-get install apt-transport-https curl gnupg -yqq && \
echo "deb https://repo.scala-sbt.org/scalasbt/debian all main" | tee /etc/apt/sources.list.d/sbt.list && \
echo "deb https://repo.scala-sbt.org/scalasbt/debian /" | tee /etc/apt/sources.list.d/sbt_old.list && \
curl -sL "https://keyserver.ubuntu.com/pks/lookup?op=get&search=0x2EE0EA64E40A89B84B2DF73499E82A75642AC823" | gpg --no-default-keyring --keyring gnupg-ring:/etc/apt/trusted.gpg.d/scalasbt-release.gpg --import && \
chmod 644 /etc/apt/trusted.gpg.d/scalasbt-release.gpg && \
apt-get update && \
apt-get install sbt=$SBT_VERSION && \
sbt sbtVersion
我收到一条错误消息,提示 E:未找到 'sbt' 的版本“1.5.8”
我不得不将我的工作目录从默认 /
更改为让它工作。尝试下面(WORKDIR
更改文件夹,命令中的 cd
可能具有相同的效果)可以。这为我构建并运行 sbt
命令。
FROM openjdk:8 as build
ENV SBT_VERSION "1.5.8"
ENV APP_HOME /service
WORKDIR $APP_HOME
RUN \
apt-get update && \
apt-get install apt-transport-https curl gnupg -yqq && \
echo "deb https://repo.scala-sbt.org/scalasbt/debian all main" | tee /etc/apt/sources.list.d/sbt.list && \
echo "deb https://repo.scala-sbt.org/scalasbt/debian /" | tee /etc/apt/sources.list.d/sbt_old.list && \
curl -sL "https://keyserver.ubuntu.com/pks/lookup?op=get&search=0x2EE0EA64E40A89B84B2DF73499E82A75642AC823" | gpg --no-default-keyring --keyring gnupg-ring:/etc/apt/trusted.gpg.d/scalasbt-release.gpg --import && \
chmod 644 /etc/apt/trusted.gpg.d/scalasbt-release.gpg && \
apt-get update && \
apt-get install sbt=$SBT_VERSION && \
sbt sbtVersion
root@a94ff4797239:/service# sbt
[info] welcome to sbt 1.5.8 (Oracle Corporation Java 1.8.0_312)
[info] loading project definition from /service/project
[info] set current project to service (in build file:/service/)
[info] sbt server started at local:///root/.sbt/1.0/server/c75bcef1d951ec508da8/sock
[info] started sbt server
sbt:service>