Add docker skeleton
This commit is contained in:
11
bsp/include/docker.mk
Normal file
11
bsp/include/docker.mk
Normal 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
45
bsp/scripts/docker-build.sh
Executable 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
|
||||
Reference in New Issue
Block a user