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

kostis-codefresh/docker-maven-comparison: Comparing the Spotify and fabric8 dock ...

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

开源软件名称(OpenSource Name):

kostis-codefresh/docker-maven-comparison

开源软件地址(OpenSource Url):

https://github.com/kostis-codefresh/docker-maven-comparison

开源编程语言(OpenSource Language):

Java 43.6%

开源软件介绍(OpenSource Introduction):

Using Docker from Maven and Maven from Docker

Docker plus Maven

Codefresh status: Codefresh build status

This repository holds the code mentioned in the Codefresh blog post "Using Docker from Maven and Maven from Docker"

It consists of 4 individual projects mentioned in the article

  1. A Java project that uses the Maven spotify plugin
  2. A Java project that uses the Fabric8 Maven plugin (also runs integration tests)
  3. A Java project with a Multi-stage dockerfile that runs Maven from within Docker
  4. The same multi-stage Java projects with a YAML build file for Codefresh

Instructions for each project

Maven Spotify plugin

To build the project

cd 01-using-spotify-plugin
mvn package

This command will create a Docker image

Maven Fabric8 plugin

To build the project and run integration tests

cd 02-using-fabric8-plugin
mvn verify

This command will

  1. compile and the code create a Docker image
  2. launch the docker image and run integration tests against it

Multi-stage build

To build the project and run unit tests

cd 03-multistage
docker build -t my-java-app .

This command will

  1. Download a Maven docker image and use it to compile the code and run unit tests
  2. Keep the WAR file produced it will place it in a Tomcat Docker image

Multi-stage build (with Codefresh)

Create a Codefresh account and use the provided build yaml file.

version: '1.0'
steps:
  build_image:
    type: build
    description: Building the image...
    image_name: docker-maven-comparison
    working_directory: ./04-codefresh
    tag: develop
  build_image_with_tests:
    type: build
    description: Building the Test image...
    image_name: maven-integration-tests
    working_directory: ./04-codefresh
    dockerfile: Dockerfile.testing
  integration_tests:
    type: composition
    title: Launching QA environment
    description: Temporary test environment
    working_directory: ${{main_clone}}
    composition:
      version: '2'
      services:
        app:
          image: ${{build_image}}
          ports:
           - 8080
    composition_candidates:
      test_service: 
        image: ${{build_image_with_tests}}
        links:
          - app
        command: bash -c '/usr/bin/wait-for-it.sh -t 20 app:8080 -- mvn verify -Dserver.host=app'

Once build this Codefresh YAML will

  1. Create a multi-stage Docker image with the war file (based on Tomcat) also running unit tests
  2. Create a Maven image that holds the integration tests
  3. Launch the tomcat image and run the integration tests against it (using wait-for-it.sh as well)



鲜花

握手

雷人

路过

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

请发表评论

全部评论

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

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

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

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

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