Grails 3.1.4和Docker – grails命令返回“找不到名称web的配置文件”

前端之家收集整理的这篇文章主要介绍了Grails 3.1.4和Docker – grails命令返回“找不到名称web的配置文件”前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。

我有一个简单的grails应用程序,它本身运行良好.使用带有grails run-app的grails web配置文件没有问题

但是,当我从应用程序构建docker镜像时,grails命令(如grails run-app –stacktrace或grails dependency-report –stacktrace发送到docker会失败并发生堆栈跟踪:

| Error Error occurred running Grails CLI: No profile found for name [web]. (NOTE: Stack trace has been filtered. Use --verbose to see entire trace.)
java.lang.IllegalStateException: No profile found for name [web].
    at org.grails.cli.GrailsCli.initializeProfile(GrailsCli.groovy:507)
    at org.grails.cli.GrailsCli.initializeApplication(GrailsCli.groovy:308)
    at org.grails.cli.GrailsCli.execute(GrailsCli.groovy:271)
    at org.grails.cli.GrailsCli.main(GrailsCli.groovy:162)
| Error Error occurred running Grails CLI: No profile found for name [web].

Docker Build命令:
从grails应用程序的根目录运行.
用户位于docker组中.

docker build -t mygrailsapp .

DockerFile:
(构建将在RUN grails依赖项 – report –stacktrace上失败.如果我删除该命令,则构建完成.但是,第一次使用default命令运行应用程序时它会失败并出现相同的错误.)

#
# My Dockerfile
#
# https://github.com/dockerfile/java
# https://github.com/dockerfile/java/tree/master/oracle-java8
# https://hub.docker.com/r/mozart/grails/

# Pull base image. 
FROM ubuntu

RUN apt-get update

# install apt-get-repository
RUN \
    apt-get install -y software-properties-common wget unzip git

# Install Java.
RUN \
  echo oracle-java8-installer shared/accepted-oracle-license-v1-1 select true | debconf-set-selections && \
  add-apt-repository -y ppa:webupd8team/java && \
  apt-get update && \
  apt-get install -y oracle-java8-installer
  rm -rf /var/lib/apt/lists/* && \
  rm -rf /var/cache/oracle-jdk8-installer

# Define working directory.
WORKDIR /data

# Define commonly used JAVA_HOME variable
ENV JAVA_HOME /usr/lib/jvm/java-8-oracle


# Set customizable env vars defaults.
# Set Grails version (default: 3.1.4; min: 3.0.0; max: 3.1.4).
ENV GRAILS_VERSION 3.1.4

# Install Grails
WORKDIR /usr/lib/jvm

# TODO put grails zips on your own server with decent bandwidth
RUN wget https://github.com/grails/grails-core/releases/download/v$GRAILS_VERSION/grails-$GRAILS_VERSION.zip && \
    unzip grails-$GRAILS_VERSION.zip && \
    rm -rf grails-$GRAILS_VERSION.zip && \
    ln -s grails-$GRAILS_VERSION grails

# Setup Grails path.
ENV GRAILS_HOME /usr/lib/jvm/grails
ENV PATH $GRAILS_HOME/bin:$PATH

# Create App Directory
RUN mkdir /app

# Set Workdir
WORKDIR /app

# Copy App files
COPY . /app

# Run Grails dependency-report command to pre-download dependencies but not
# create unnecessary build files or artifacts.
RUN grails dependency-report --stacktrace

# Set Default Behavior
ENTRYPOINT ["grails"]

CMD ["run-app"]

建立:

Ubuntu 14.04 LTS 64

Jave:Oracle JDK 1.8.0_77 64

通过sdkman 4.0.32:

Grails 3.14
Groovy 2.4.6
Gradle 2.12

搬运工人
客户:
 版本:1.10.3
 API版本:1.22
 转到版本:go1.5.3
 Git commit:20f81dd
 建造:2016年3月10日星期四15:54:52
 OS / Arch:linux / amd64

最佳答案
当我移动使用Web配置文件的Grails 3.1.4应用程序到新机器时,我遇到了同样的问题.

在我的应用程序根目录中执行gradle clean会触发正在下载的Grails Maven依赖项,之后grails命令开始工作.

原文链接:https://www.f2er.com/docker/436879.html

猜你在找的Docker相关文章