-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathMakefile
63 lines (54 loc) · 1.58 KB
/
Makefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
# VE mapping
VE_NODE_NUMBER?=1
VENODEID=${VE_NODE_NUMBER}
VE=$(shell readlink -f /dev/veslot${VENODEID})
# Base img properties
BASEIMG_NAME?=centos
BASEIMG_VERSION?=8.3.2011
NEC_TOOLS_VERSION?=2.3-1
# Docker image properties
IMAGE_NAME=vebox
VERSION_TAG=develop
VEBOX_CONTAINER=vebox
# Current user info for creating it inside the container
CUID=$(shell id -u)
CUNAME=$(shell id -un)
CGID=$(shell id -g)
CGNAME=$(shell id -gn)
BASE_PATH=${PWD}/ve-base-dev-docker
all: build_context build_image run_image
build_context:
rm -rf context/
mkdir -p context
python3 ve-box.py ${BASEIMG_NAME} ${BASEIMG_VERSION} ${NEC_TOOLS_VERSION}
cp ${BASE_PATH}/dnf.conf context/
cp ${BASE_PATH}/TSUBASA-repo.repo context/
cp ${BASE_PATH}/CentOS-Base.repo context/
cp ${BASE_PATH}/CentOS-Extras.repo context/
cp ${BASE_PATH}/CentOS-AppStream.repo context/
build_image:
cd context && docker build \
--network host \
--tag ${IMAGE_NAME}:${VERSION_TAG} \
--build-arg host_proxy=${http_proxy} \
.
cd context && docker image tag ${IMAGE_NAME}:${VERSION_TAG} ${IMAGE_NAME}:latest
run_image:
echo "Device ${VE}"
docker run \
-e CURR_UNAME=${CUNAME} -e CURR_GNAME=${CGNAME} \
-e CURR_UID=${CUID} -e CURR_GID=${CGID} -e CURR_HOME=${HOME} \
-v /dev:/dev:z \
--device ${VE}:${VE} \
-v /var/opt/nec/ve/veos:/var/opt/nec/ve/veos:z \
-v ${HOME}:${HOME}:z \
-u $(shell id -u):$(shell id -g) \
-w ${PWD} \
--rm -it \
--network host \
--name ${VEBOX_CONTAINER} \
--mount type=bind,source=${PWD}/workdir,target=/opt/workdir \
${IMAGE_NAME}:latest \
/bin/bash
help:
cat Makefile