blob: d7be421a4064d95167246338a711b90ff9645836 [file] [log] [blame]
A R Karthicke3bde962016-09-27 15:06:35 -07001# Docker container Makefile for XOS
2#
3# Targets:
4#
5# `base` - XOS prerequistie files, no XOS code, builds xosproject/xos-base
6# `build` - base + XOS code, git pulled in Dockerfile from main repo,
7# builds xosproject/xos
8# `custom` - base + XOS code, git pulled in Dockerfile from selectable repo,
9# builds xosproject/xos
10# `devel` - base + XOS code from local directory, builds xosproject/xos
11# `test` - xosproject/xos + nodejs testing frameworks, builds
12# xosproject/xos-test
13#
14
15NO_DOCKER_CACHE ?= false
16
17CONTAINER_NAME ?= xos-server
18IMAGE_NAME ?= xosproject/xos
19
20XOS_GIT_REPO ?= https://github.com/opencord/xos.git
21XOS_GIT_BRANCH ?= master
22
23XOS_GIT_COMMIT_HASH ?= $(shell git log --pretty=format:'%H' -n 1 || echo -n "unknown" )
24XOS_GIT_COMMIT_DATE ?= $(shell git log --pretty=format:'%ad' -n 1 || echo -n "unknown" )
25
26TOSCA_CONFIG_PATH ?= /opt/xos/configurations/opencloud/opencloud.yaml
27
28BUILD_ARGS =
29ifdef http_proxy
30BUILD_ARGS += --build-arg http_proxy=${http_proxy}
31endif
32ifdef https_proxy
33BUILD_ARGS += --build-arg https_proxy=${https_proxy}
34endif
35
36base:
37 sudo docker build --no-cache=${NO_DOCKER_CACHE} --rm \
38 -f Dockerfile.base -t xosproject/xos-base ${BUILD_ARGS} .
39
40build:
41 sudo docker build --no-cache=${NO_DOCKER_CACHE} --rm \
42 -f Dockerfile -t ${IMAGE_NAME} ${BUILD_ARGS} .
43
44custom:
45 docker build --no-cache=${NO_DOCKER_CACHE} --rm \
46 --build-arg XOS_GIT_REPO=${XOS_GIT_REPO} \
47 --build-arg XOS_GIT_BRANCH=${XOS_GIT_BRANCH} \
48 -f Dockerfile -t ${IMAGE_NAME} ${BUILD_ARGS} .
49
50devel:
51 sudo docker build --no-cache=${NO_DOCKER_CACHE} --rm \
52 --build-arg XOS_GIT_COMMIT_HASH="${XOS_GIT_COMMIT_HASH}" \
53 --build-arg XOS_GIT_COMMIT_DATE="${XOS_GIT_COMMIT_DATE}" \
54 -f Dockerfile.devel -t ${IMAGE_NAME} ${BUILD_ARGS} ../..
55
56test:
57 sudo docker build --no-cache=${NO_DOCKER_CACHE} --rm \
58 -f Dockerfile.test -t xosproject/xos-test ${BUILD_ARGS} ../..
59
60run:
61 sudo docker run -d --name ${CONTAINER_NAME} -p 80:8000 \
62 ${IMAGE_NAME}
63
64runtosca:
65 sudo docker exec -it ${CONTAINER_NAME} \
66 /usr/bin/python /opt/xos/tosca/run.py padmin@vicci.org ${TOSCA_CONFIG_PATH}
67
68stop:
69 sudo docker stop ${CONTAINER_NAME}
70
71rm:
72 sudo docker rm ${CONTAINER_NAME}
73
74rmi:
75 sudo docker rmi `docker images | grep "^<none>" | awk '{print $$3}'`
76