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'
uj5u.com熱心網友回復:
我必須將我的作業目錄從默認值更改/為使其正常作業。試試下面(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>
轉載請註明出處,本文鏈接:https://www.uj5u.com/qianduan/405119.html
標籤:
上一篇:無法從根目錄運行sbt
