-
Notifications
You must be signed in to change notification settings - Fork 644
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
copy goal for copying files / directories from container to host.
Signed-off-by: Marat Abrarov <[email protected]>
- Loading branch information
Showing
43 changed files
with
2,447 additions
and
139 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,84 @@ | ||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | ||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> | ||
<modelVersion>4.0.0</modelVersion> | ||
|
||
<parent> | ||
<groupId>io.fabric8.dmp.itests</groupId> | ||
<artifactId>dmp-it-builder-parent</artifactId> | ||
<version>0.34-SNAPSHOT</version> | ||
</parent> | ||
|
||
<artifactId>dmp-it-builder-app-image</artifactId> | ||
<packaging>pom</packaging> | ||
|
||
<dependencies> | ||
<dependency> | ||
<groupId>io.fabric8.dmp.itests</groupId> | ||
<artifactId>dmp-it-builder-app</artifactId> | ||
<type>tar.gz</type> | ||
</dependency> | ||
</dependencies> | ||
|
||
<build> | ||
<plugins> | ||
<plugin> | ||
<groupId>org.apache.maven.plugins</groupId> | ||
<artifactId>maven-assembly-plugin</artifactId> | ||
<executions> | ||
<execution> | ||
<id>build-context</id> | ||
<phase>generate-resources</phase> | ||
<goals> | ||
<goal>single</goal> | ||
</goals> | ||
<configuration> | ||
<finalName>context</finalName> | ||
<appendAssemblyId>false</appendAssemblyId> | ||
<attach>false</attach> | ||
<descriptors> | ||
<descriptor>src/assembly/context.xml</descriptor> | ||
</descriptors> | ||
</configuration> | ||
</execution> | ||
</executions> | ||
</plugin> | ||
<plugin> | ||
<groupId>io.fabric8</groupId> | ||
<artifactId>docker-maven-plugin</artifactId> | ||
<configuration> | ||
<images> | ||
<image> | ||
<name>${app.image}</name> | ||
<build> | ||
<contextDir>${project.build.directory}/context</contextDir> | ||
<filter>false</filter> | ||
</build> | ||
<run> | ||
<wait> | ||
<exit>0</exit> | ||
</wait> | ||
</run> | ||
</image> | ||
</images> | ||
</configuration> | ||
<executions> | ||
<execution> | ||
<id>build-image</id> | ||
<phase>package</phase> | ||
<goals> | ||
<goal>build</goal> | ||
</goals> | ||
</execution> | ||
<execution> | ||
<id>run</id> | ||
<phase>integration-test</phase> | ||
<goals> | ||
<goal>start</goal> | ||
<goal>stop</goal> | ||
</goals> | ||
</execution> | ||
</executions> | ||
</plugin> | ||
</plugins> | ||
</build> | ||
</project> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
<assembly xmlns="http://maven.apache.org/ASSEMBLY/2.1.0" | ||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | ||
xsi:schemaLocation="http://maven.apache.org/ASSEMBLY/2.1.0 http://maven.apache.org/xsd/assembly-2.1.0.xsd"> | ||
<id>context</id> | ||
<formats> | ||
<format>dir</format> | ||
</formats> | ||
<includeBaseDirectory>false</includeBaseDirectory> | ||
<files> | ||
<file> | ||
<source>src/main/docker/Dockerfile</source> | ||
<filtered>true</filtered> | ||
<lineEnding>unix</lineEnding> | ||
</file> | ||
</files> | ||
<dependencySets> | ||
<dependencySet> | ||
<outputDirectory/> | ||
<includes> | ||
<include>*:*:tar.gz</include> | ||
</includes> | ||
<useProjectArtifact>false</useProjectArtifact> | ||
<outputFileNameMapping>${artifact.artifactId}.${artifact.extension}</outputFileNameMapping> | ||
</dependencySet> | ||
</dependencySets> | ||
</assembly> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
FROM scratch | ||
|
||
CMD ["/hello"] | ||
|
||
ADD ["dmp-it-builder-app.tar.gz", "/"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,76 @@ | ||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | ||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> | ||
<modelVersion>4.0.0</modelVersion> | ||
|
||
<parent> | ||
<groupId>io.fabric8.dmp.itests</groupId> | ||
<artifactId>dmp-it-builder-parent</artifactId> | ||
<version>0.34-SNAPSHOT</version> | ||
</parent> | ||
|
||
<artifactId>dmp-it-builder-app</artifactId> | ||
<packaging>pom</packaging> | ||
|
||
<dependencies> | ||
<dependency> | ||
<groupId>io.fabric8.dmp.itests</groupId> | ||
<artifactId>dmp-it-builder-builder-image</artifactId> | ||
<type>pom</type> | ||
</dependency> | ||
</dependencies> | ||
|
||
<build> | ||
<plugins> | ||
<plugin> | ||
<groupId>io.fabric8</groupId> | ||
<artifactId>docker-maven-plugin</artifactId> | ||
<executions> | ||
<execution> | ||
<id>copy-from-builder</id> | ||
<phase>generate-resources</phase> | ||
<goals> | ||
<goal>copy</goal> | ||
</goals> | ||
<configuration> | ||
<images> | ||
<image> | ||
<name>${builder.image}</name> | ||
<copy> | ||
<entries> | ||
<entry> | ||
<containerPath>${builder.output.file}</containerPath> | ||
<hostDirectory>${project.build.directory}</hostDirectory> | ||
</entry> | ||
</entries> | ||
</copy> | ||
</image> | ||
</images> | ||
<createContainers>true</createContainers> | ||
</configuration> | ||
</execution> | ||
</executions> | ||
</plugin> | ||
<plugin> | ||
<groupId>org.codehaus.mojo</groupId> | ||
<artifactId>build-helper-maven-plugin</artifactId> | ||
<executions> | ||
<execution> | ||
<id>attach-artifact</id> | ||
<phase>package</phase> | ||
<goals> | ||
<goal>attach-artifact</goal> | ||
</goals> | ||
<configuration> | ||
<artifacts> | ||
<artifact> | ||
<file>${project.build.directory}/${builder.output.fileName}</file> | ||
<type>tar.gz</type> | ||
</artifact> | ||
</artifacts> | ||
</configuration> | ||
</execution> | ||
</executions> | ||
</plugin> | ||
</plugins> | ||
</build> | ||
</project> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
/build/ | ||
/.idea/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
cmake_minimum_required(VERSION 3.0) | ||
|
||
project(hello LANGUAGES C) | ||
|
||
set(compile_definitions) | ||
if(WIN32) | ||
list(APPEND compile_definitions WIN32 _UNICODE UNICODE) | ||
endif() | ||
|
||
if(MINGW) | ||
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -municode") | ||
endif() | ||
|
||
add_executable(${PROJECT_NAME} "src/main/c/hello.c") | ||
target_compile_definitions(${PROJECT_NAME} PRIVATE ${compile_definitions}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,78 @@ | ||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | ||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> | ||
<modelVersion>4.0.0</modelVersion> | ||
|
||
<parent> | ||
<groupId>io.fabric8.dmp.itests</groupId> | ||
<artifactId>dmp-it-builder-parent</artifactId> | ||
<version>0.34-SNAPSHOT</version> | ||
</parent> | ||
|
||
<artifactId>dmp-it-builder-builder-image</artifactId> | ||
<packaging>pom</packaging> | ||
|
||
<build> | ||
<plugins> | ||
<plugin> | ||
<groupId>org.apache.maven.plugins</groupId> | ||
<artifactId>maven-assembly-plugin</artifactId> | ||
<executions> | ||
<execution> | ||
<id>build-rootfs</id> | ||
<phase>generate-resources</phase> | ||
<goals> | ||
<goal>single</goal> | ||
</goals> | ||
<configuration> | ||
<finalName>rootfs</finalName> | ||
<appendAssemblyId>false</appendAssemblyId> | ||
<attach>false</attach> | ||
<descriptors> | ||
<descriptor>src/assembly/rootfs.xml</descriptor> | ||
</descriptors> | ||
</configuration> | ||
</execution> | ||
<execution> | ||
<id>build-context</id> | ||
<phase>generate-resources</phase> | ||
<goals> | ||
<goal>single</goal> | ||
</goals> | ||
<configuration> | ||
<finalName>context</finalName> | ||
<appendAssemblyId>false</appendAssemblyId> | ||
<attach>false</attach> | ||
<descriptors> | ||
<descriptor>src/assembly/context.xml</descriptor> | ||
</descriptors> | ||
</configuration> | ||
</execution> | ||
</executions> | ||
</plugin> | ||
<plugin> | ||
<groupId>io.fabric8</groupId> | ||
<artifactId>docker-maven-plugin</artifactId> | ||
<configuration> | ||
<images> | ||
<image> | ||
<name>${builder.image}</name> | ||
<build> | ||
<contextDir>${project.build.directory}/context</contextDir> | ||
<filter>false</filter> | ||
</build> | ||
</image> | ||
</images> | ||
</configuration> | ||
<executions> | ||
<execution> | ||
<id>build-image</id> | ||
<phase>package</phase> | ||
<goals> | ||
<goal>build</goal> | ||
</goals> | ||
</execution> | ||
</executions> | ||
</plugin> | ||
</plugins> | ||
</build> | ||
</project> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
<assembly xmlns="http://maven.apache.org/ASSEMBLY/2.1.0" | ||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | ||
xsi:schemaLocation="http://maven.apache.org/ASSEMBLY/2.1.0 http://maven.apache.org/xsd/assembly-2.1.0.xsd"> | ||
<id>context</id> | ||
<formats> | ||
<format>dir</format> | ||
</formats> | ||
<includeBaseDirectory>false</includeBaseDirectory> | ||
<files> | ||
<file> | ||
<source>src/main/docker/Dockerfile</source> | ||
<filtered>true</filtered> | ||
<lineEnding>unix</lineEnding> | ||
</file> | ||
<file> | ||
<source>${project.build.directory}/rootfs.tar</source> | ||
</file> | ||
</files> | ||
</assembly> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
<assembly xmlns="http://maven.apache.org/ASSEMBLY/2.1.0" | ||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | ||
xsi:schemaLocation="http://maven.apache.org/ASSEMBLY/2.1.0 http://maven.apache.org/xsd/assembly-2.1.0.xsd"> | ||
<id>rootfs</id> | ||
<formats> | ||
<format>tar</format> | ||
</formats> | ||
<includeBaseDirectory>false</includeBaseDirectory> | ||
<fileSets> | ||
<fileSet> | ||
<outputDirectory/> | ||
<directory>${project.basedir}</directory> | ||
<includes> | ||
<include>src/main/c/*.c</include> | ||
<include>CMakeLists.txt</include> | ||
<include>*.cmake</include> | ||
</includes> | ||
<lineEnding>unix</lineEnding> | ||
</fileSet> | ||
</fileSets> | ||
</assembly> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
#if defined(WIN32) | ||
#include <tchar.h> | ||
#endif | ||
|
||
#include <stdlib.h> | ||
#include <stdio.h> | ||
#include <string.h> | ||
|
||
static const char *message = "Hello World!"; | ||
|
||
#if defined(WIN32) | ||
int _tmain(int argc, _TCHAR **argv) { | ||
#else | ||
int main(int argc, char **argv) { | ||
#endif | ||
size_t len = strlen(message); | ||
size_t written = fwrite(message, sizeof(char), len, stdout); | ||
return written == len ? EXIT_SUCCESS : EXIT_FAILURE; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
FROM alpine | ||
|
||
RUN apk add --no-cache gcc libc-dev make cmake tar | ||
|
||
ADD ["rootfs.tar", "/usr/src/hello"] | ||
|
||
RUN output_file="@builder.output.file@" && \ | ||
source_dir="/usr/src/hello" && \ | ||
build_dir="$(mktemp -d)" && \ | ||
cmake \ | ||
-D CMAKE_SKIP_BUILD_RPATH=ON \ | ||
-D CMAKE_BUILD_TYPE=RELEASE \ | ||
-D CMAKE_USER_MAKE_RULES_OVERRIDE=static.cmake \ | ||
-S "${source_dir}" \ | ||
-B "${build_dir}" && \ | ||
cmake --build "${build_dir}" && \ | ||
mkdir -p "$(dirname "${output_file}")" && \ | ||
tar --sort=name --owner=root:0 --group=root:0 --mtime='UTC 1970-01-01' \ | ||
-C "${build_dir}" -czf "${output_file}" hello && \ | ||
rm -rf "${build_dir}" && \ | ||
echo "Built binaries location: ${output_file}" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
# Use CMAKE_USER_MAKE_RULES_OVERRIDE command line argument to point these rules | ||
|
||
if(MSVC) | ||
set(CMAKE_C_FLAGS_DEBUG_INIT "/D_DEBUG /MTd /Zi /Ob0 /Od /RTC1") | ||
set(CMAKE_C_FLAGS_MINSIZEREL_INIT "/MT /O1 /Ob1 /D NDEBUG") | ||
set(CMAKE_C_FLAGS_RELEASE_INIT "/MT /O2 /Ob2 /D NDEBUG") | ||
set(CMAKE_C_FLAGS_RELWITHDEBINFO_INIT "/MT /Zi /O2 /Ob1 /D NDEBUG") | ||
elseif(CMAKE_C_COMPILER_ID MATCHES "Clang") | ||
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -static") | ||
elseif(CMAKE_COMPILER_IS_GNUCC) | ||
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -static -static-libgcc") | ||
endif() |
Oops, something went wrong.