• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

bdunbar/docker-gradle: A Gradle executable container based on dockerfile/java:or ...

原作者: [db:作者] 来自: 网络 收藏 邀请

开源软件名称(OpenSource Name):

bdunbar/docker-gradle

开源软件地址(OpenSource Url):

https://github.com/bdunbar/docker-gradle

开源编程语言(OpenSource Language):


开源软件介绍(OpenSource Introduction):

Gradle Executable Container

This docker image includes Oracle Java 7 and Gradle 2.1 configured with Gradle as the entrypoint.

Usage

By defaut, running this image without any command will run gradle -version in the /app directory.

Doing Something Actually Useful

To run something more interesting, say gradle clean war, you should mount your project root in /app. For example, you can run the following to create a deployable web archive.

docker run --rm -v /path/to/your/project:/app:rw niaquinto/gradle clean war

Plugins

Of course, you can use any command here, including those dependent on plugins. For example, if you project inlcudes the Jetty plugin (by including apply plugin: 'jetty' in its build.gradle) you can run the following command to start an instance of Jetty running a WAR of your application on port 8080 on the host.

docker run --rm -p 8080:8080 -v /path/to/your/project:/app:rw niaquinto/gradle jettyRunWar

You can find your app deployed at http://localhost:8080/app

Changing the Default Behavior

Say you want gradle clean war to run if you launch the container without any options. To do that, just make a new dockerfile like the following. Also, while your at it, you should change the user to match your development environment (so that running the container doesn't keep chown'ing your /build directory to root).

# Use this image as a base
FROM niaquinto/gradle
MAINTAINER your-name <[email protected]>

# In case someone loses the Dockerfile
RUN rm -rf /etc/Dockerfile
ADD Dockerfile /etc/Dockerfile

# Add your desired user and group
RUN groupadd your-group-name
RUN useradd -s /bin/bash -m -d /app -g your-group-name your-user-name

# Set your desired user as default
USER your-user-name

# Set your default behavior
ENTRYPOINT ["gradle"]
CMD ["clean", "war"]

Get the Image

To build this image yourself, run...

docker build github.com/niaquinto/docker-gradle

Or, you can pull the image from the central docker repository by using...

docker pull niaquinto/gradle



鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap