我正试图以此发动战争,并部署到jboss https://github.com/tongueroo/demo-java
我的docker文件
FROM jboss/wildfly
RUN /opt/jboss/wildfly/bin/add-user.sh admin Admin#70365 --silent
CMD ["/opt/jboss/wildfly/bin/standalone.sh", "-b", "0.0.0.0", "-bmanagement", "0.0.0.0
CMD ["git clone https://github.com/tongueroo/demo-java"]
CMD ["cd docker-tomcat-java-example"]
CMD ["./gradlew build"]
但是我不知道下一步该怎么做,您能帮我吗?
答案 0 :(得分:0)
最简单的方法是在构建docker映像之前先构建war,然后使用Dockerfile中的COPY运算符将war放入您的wildfly部署文件夹中。像这样:
frankjmattia@lappy-i686 % rake
Run options: --seed 43000
# Running:
Capybara starting Puma...
* Version 3.12.1 , codename: Llamas in Pajamas
* Min threads: 1, max threads: 1
* Listening on ssl://127.0.0.1:56260?key=/Users/frankjmattia/src/blorgh/ssl/blorgh.test.key.pem&cert=/Users/frankjmattia/src/blorgh/ssl/blorgh.test.cert.pem
2019-04-28 16:59:48 -0400: SSL error, peer: 127.0.0.1, peer cert: , #<Puma::MiniSSL::SSLError: OpenSSL error: error:1407609C:SSL routines:SSL23_GET_CLIENT_HELLO:http request - 336027804>
2019-04-28 16:59:49 -0400: SSL error, peer: 127.0.0.1, peer cert: , #<Puma::MiniSSL::SSLError: OpenSSL error: error:1407609C:SSL routines:SSL23_GET_CLIENT_HELLO:http request - 336027804>
.
Finished in 3.177669s, 0.3147 runs/s, 0.3147 assertions/s.
1 runs, 1 assertions, 0 failures, 0 errors, 0 skips
2019-04-28 16:59:49 -0400: Read error: #<EOFError: EOFError>
/Users/frankjmattia/.asdf/installs/ruby/2.6.2/lib/ruby/gems/2.6.0/gems/puma-3.12.1/lib/puma/client.rb:306:in `try_to_finish'
/Users/frankjmattia/.asdf/installs/ruby/2.6.2/lib/ruby/gems/2.6.0/gems/puma-3.12.1/lib/puma/client.rb:119:in `reset'
/Users/frankjmattia/.asdf/installs/ruby/2.6.2/lib/ruby/gems/2.6.0/gems/puma-3.12.1/lib/puma/server.rb:486:in `process_client'
/Users/frankjmattia/.asdf/installs/ruby/2.6.2/lib/ruby/gems/2.6.0/gems/puma-3.12.1/lib/puma/server.rb:334:in `block in run'
/Users/frankjmattia/.asdf/installs/ruby/2.6.2/lib/ruby/gems/2.6.0/gems/puma-3.12.1/lib/puma/thread_pool.rb:135:in `block in spawn_thread'
这可能会更清洁,并且可以使用CI轻松实现。
如果您确实需要在docker文件中执行此操作(我认为您不需要这样做),则应在CMD之前使用RUN命令,安装git和gradle然后进行克隆和构建。像这样...
COPY /build/libs/foo.war /opt/jboss/wildfly/standalone/deployments/
再说一次,对于我来说,对于docker文件来说,这太过分了,应该将此逻辑移植到连续的集成中,但是从理论上讲应该是可能的