Add docker skeleton

This commit is contained in:
2019-04-03 23:04:25 +02:00
parent bfdb430980
commit c19d686cfb
7 changed files with 66 additions and 3289 deletions

64
.vscode/settings.json vendored
View File

@@ -1,61 +1,11 @@
{ {
"files.exclude": { "files.exclude": {
"**/_builds/delivery": true,
"**/_builds/dl": true, "**/_builds/dl": true,
"**/_builds/*/buildroot/build": true "**/_builds/*/buildroot/build": true,
}, "**/_builds/*/buildroot/dtb": true,
"files.associations": { "**/_builds/*/buildroot/images": true,
"*.ipp": "cpp", "**/_builds/*/buildroot/scripts": true,
"functional": "cpp", "**/_builds/*/buildroot/target": true
"rope": "cpp", }
"typeinfo": "cpp",
"typeindex": "cpp",
"array": "cpp",
"*.tcc": "cpp",
"cmath": "cpp",
"complex": "cpp",
"cstdint": "cpp",
"exception": "cpp",
"algorithm": "cpp",
"chrono": "cpp",
"system_error": "cpp",
"tuple": "cpp",
"type_traits": "cpp",
"initializer_list": "cpp",
"iosfwd": "cpp",
"istream": "cpp",
"new": "cpp",
"ostream": "cpp",
"sstream": "cpp",
"stdexcept": "cpp",
"streambuf": "cpp",
"cctype": "cpp",
"cfenv": "cpp",
"cinttypes": "cpp",
"cstdio": "cpp",
"cstdlib": "cpp",
"cwchar": "cpp",
"cwctype": "cpp",
"utility": "cpp",
"clocale": "cpp",
"csetjmp": "cpp",
"csignal": "cpp",
"cstdarg": "cpp",
"cstddef": "cpp",
"cstring": "cpp",
"ctime": "cpp",
"atomic": "cpp",
"codecvt": "cpp",
"condition_variable": "cpp",
"slist": "cpp",
"future": "cpp",
"limits": "cpp",
"memory": "cpp",
"mutex": "cpp",
"ratio": "cpp",
"scoped_allocator": "cpp",
"thread": "cpp"
},
"cSpell.words": [
"NADAL"
]
} }

11
bsp/include/docker.mk Normal file
View File

@@ -0,0 +1,11 @@
VERSION := latest
docker.build:
@echo "Docker build image."
@echo $(BR_PROJECT_NAME) : $(VERSION)
$(shell pwd)/../../bsp/scripts/docker-build.sh $(BR_STAGING) $(BR_PROJECT) $(BR_PROJECT_NAME) $(VERSION)
docker.run:
@echo "Docker run image."
docker -D run -t -i $(BR_PROJECT_NAME):v$(VERSION) /bin/sh

45
bsp/scripts/docker-build.sh Executable file
View File

@@ -0,0 +1,45 @@
#!/bin/bash
echo "Build Docker Image."
stagingPath=$1
projectPath=$2
projectName=$3
version=$4
echo "Staging: $stagingPath"
echo "projectPath: $projectPath"
echo "projectName: $projectName"
echo "version: $version"
HAS_IMAGE=`docker image ls ${projectName}:v${version} | wc -l`
if [ $HAS_IMAGE -eq "2" ]; then
echo "The image existe we remove it first"
docker image rm -f ${projectName}:v${version}
fi
rm -rf $stagingPath/docker-build
mkdir -p $stagingPath/docker-build/rootfs/
mkdir -p $stagingPath/docker-build/rootfs/dev
mkdir -p $stagingPath/docker-build/rootfs/media
mkdir -p $stagingPath/docker-build/rootfs/mnt
mkdir -p $stagingPath/docker-build/rootfs/proc
mkdir -p $stagingPath/docker-build/rootfs/run
mkdir -p $stagingPath/docker-build/rootfs/srv
mkdir -p $stagingPath/docker-build/rootfs/sys
mkdir -p $stagingPath/docker-build/rootfs/tmp
mkdir -p $stagingPath/docker-build/rootfs/usr/local/
cp $projectPath/configs/Dockerfile $stagingPath/docker-build
cp -a $stagingPath/buildroot/target/bin $stagingPath/docker-build/rootfs/
cp -a $stagingPath/buildroot/target/etc $stagingPath/docker-build/rootfs/
cp -a $stagingPath/buildroot/target/lib $stagingPath/docker-build/rootfs/
cp -a $stagingPath/buildroot/target/sbin $stagingPath/docker-build/rootfs/
cp -a $stagingPath/buildroot/target/var $stagingPath/docker-build/rootfs/
touch $stagingPath/docker-build/rootfs/etc/resolv.conf
touch $stagingPath/docker-build/rootfs/sbin/init
docker build -t ${projectName}:v${version} $stagingPath/docker-build

View File

@@ -8,3 +8,4 @@ export BR_PROJECT_NAME:=x86_64_domo
export BR_BOARD:=$(shell pwd)/../../bsp/board/domo/ export BR_BOARD:=$(shell pwd)/../../bsp/board/domo/
include $(BR_BOARD)/main.mk include $(BR_BOARD)/main.mk
include $(shell pwd)/../../bsp/include/docker.mk

View File

@@ -0,0 +1,2 @@
FROM scratch
ADD rootfs /

File diff suppressed because it is too large Load Diff

View File

@@ -1,25 +0,0 @@
#!/bin/bash
if [ -z "$1" ]; then
echo Missing parameter: path to target root directory
exit 1
fi
if [ -z "$(which virtfs-xattr)" ]; then
echo Cannot find virtfs-xattr utility
exit 1
fi
find "$1" -type l -exec bash -c '
function convert-link {
content=$(readlink "$1")
rm "$1"
echo -n "$content" > "$1"
virtfs-xattr -l "$1"
echo " Link update - $1 -> $content"
};
convert-link "$0"' {} \;
find "$1" -exec virtfs-xattr -u 0 -g 0 {} \;
exit 0