2016-11-11 6 views
1

Fabens8 Maven 도구 체인을 사용하여 Openshift 위에 내 Camel 응용 프로그램을 빌드하고 배포하고 있습니다. Camel Boot 접근법을 사용하고 있습니다 ... 내 MV 프로필은 다음 목표를 수행합니다 : clean install docker:build fabric8:json fabric8:appl.Fabric8 도구를 사용하여 최종 고정식 이미지 안에 정적 파일을 포함/복사하는 방법

모두 괜찮습니다! 단, 낙타 (Camel) 경로 앱의 일부로 Jetty을 사용하여 정적 파일 (index.html)을 제공하고 있습니다. 해당 파일은 $MY_PROJECT_DIR/src/main/resources에 있습니다. 따라서 앱의 클래스 패스는 보통 mvn build 이후입니다. 그러나 fabric8 빌드 워크 플로우를 사용할 때 My app (Camel route)는 파일 시스템 classpath에서 정적 컨텐츠를 찾을 수 없습니까?

최종 빌드 이미지의 /deployments 안에 내 정적 컨텐츠를 복사하기 위해 fabric8 플러그인을 어떻게 지정할 수 있습니까? 따라서 필자의 낙타 종점은 파일 시스템을 가리킨다. 나는 maven-resources-plugin과 같은 것을 찾고 있습니다.

+0

https://maven.fabric8.io/에서 문서를 참조하십시오. –

답변

0

음 ... 당신이 이것을 달성하기 위해 두 가지 옵션을 가지고있는 SRC 코드 I 발견 파고

  1. HAWT-앱 받는다는 - 플러그인

    당신이 사용하는 경우 hawt-app-maven-plugin [1 ] 나 같은 패키지/빌드 프로세스 중에 hawt-app.source 구성 속성을 사용할 수 hawt-app.source에 지정된 디렉터리 (기본값은 src/main/hawt-app)의 모든 내용은 ${project.build.directory}/hawt-app/에 복사됩니다.

  2. 고정 표시기 - 받는다는 - 플러그인 [2], 사용자 정의 받는다는 조립 기술자를 전달할 수 fabric8의 docker-maven-plugin 조립 구성을 사용

. 일이 같은 :

프로젝트의 의 pom.xml

<plugin> 
    <groupId>io.fabric8</groupId> 
    <artifactId>docker-maven-plugin</artifactId> 
    <version>${docker.maven.plugin.version}</version> 
    <configuration> 
    <images> 
     <image> 
     <name>${docker.image}</name> 
     <build> 
     <from>${docker.from}</from> 
     <assembly> 
      <basedir>/deployments</basedir> 
      <!-- descriptorRef>hawt-app</descriptorRef --> 
      <descriptor>${project.basedir}/src/main/resources/hawt-app-custom-assembly.xml</descriptor> 
     </assembly> 

HAWT-앱 맞춤 assembly.xml

<assembly ...> 
    <id>hawt-app</id> 
    <fileSets> 
    <fileSet> 
     <includes> 
     <include>bin/*</include> 
     </includes> 
     <directory>${project.build.directory}/hawt-app</directory> 
     <outputDirectory>.</outputDirectory> 
     <fileMode>0755</fileMode> 
    </fileSet> 
    <fileSet> 
     <includes> 
     <include>lib/*</include> 
     </includes> 
     <directory>${project.build.directory}/hawt-app</directory> 
     <outputDirectory>.</outputDirectory> 
     <fileMode>0644</fileMode> 
    </fileSet> 
    <!-- assembly extention... --> 
    <fileSet> 
     <includes> 
     <include>static-content/*</include> 
     </includes> 
     <directory>${project.basedir}/src/main/resources</directory> 
     <outputDirectory>.</outputDirectory> 
     <fileMode>0644</fileMode> 
    </fileSet> 
    </fileSets> 
</assembly> 

[1] https://github.com/fabric8io/fabric8/tree/master/hawt-app-maven-plugin

[2] https://maven.fabric8.io/#fabric8:build

[3] http://maven.apache.org/plugins/maven-assembly-plugin/assembly.html