[sonic-mgmt]: move sonic-mgmt docker build into sonic-slave (#819)
need to install sonic-device-data into sonic-mgmt docker
This commit is contained in:
parent
c075033bb6
commit
3fd2014e93
1
.gitignore
vendored
1
.gitignore
vendored
@ -47,6 +47,7 @@ dockers/docker-orchagent/Dockerfile
|
||||
dockers/docker-platform-monitor/Dockerfile
|
||||
dockers/docker-snmp-sv2/Dockerfile
|
||||
dockers/docker-teamd/Dockerfile
|
||||
dockers/docker-sonic-mgmt/Dockerfile
|
||||
platform/*/docker-syncd-*/Dockerfile
|
||||
platform/*/docker-syncd-*-rpc/Dockerfile
|
||||
|
||||
|
19
Makefile
19
Makefile
@ -25,21 +25,7 @@ DOCKER_BUILD = docker build --no-cache \
|
||||
sonic-slave && \
|
||||
docker tag $(SLAVE_IMAGE):latest $(SLAVE_IMAGE):$(SLAVE_TAG)
|
||||
|
||||
|
||||
MGMT_TAG = $(shell shasum sonic-mgmt/Dockerfile | awk '{print substr($$1,0,11);}')
|
||||
MGMT_IMAGE = sonic-mgmt-$(USER)
|
||||
|
||||
DOCKER_MGMT_BUILD = docker build --no-cache \
|
||||
--build-arg user=$(USER) \
|
||||
--build-arg uid=$(shell id -u) \
|
||||
--build-arg guid=$(shell id -g) \
|
||||
--build-arg hostname=$(shell echo $$HOSTNAME) \
|
||||
-t $(MGMT_IMAGE) \
|
||||
sonic-mgmt && \
|
||||
docker tag $(MGMT_IMAGE):latest $(MGMT_IMAGE):$(MGMT_TAG)
|
||||
|
||||
|
||||
.PHONY: sonic-slave-build sonic-slave-bash sonic-mgmt-build
|
||||
.PHONY: sonic-slave-build sonic-slave-bash
|
||||
|
||||
.DEFAULT_GOAL := all
|
||||
|
||||
@ -67,6 +53,3 @@ sonic-slave-bash :
|
||||
{ echo Image $(SLAVE_IMAGE):$(SLAVE_TAG) not found. Building... ; \
|
||||
$(DOCKER_BUILD) ; }
|
||||
@$(DOCKER_RUN) -t $(SLAVE_IMAGE):$(SLAVE_TAG) bash
|
||||
|
||||
sonic-mgmt-build :
|
||||
@$(DOCKER_MGMT_BUILD)
|
||||
|
@ -20,7 +20,7 @@ RUN apt-get install -y \
|
||||
libxslt1-dev \
|
||||
python-setuptools
|
||||
|
||||
# For JNLP launcher
|
||||
# For JNLP launcher
|
||||
RUN apt-get install -y default-jre
|
||||
|
||||
# For syslog test
|
||||
@ -44,6 +44,19 @@ RUN pip install ipaddr \
|
||||
paramiko==2.1.2 \
|
||||
adal
|
||||
|
||||
|
||||
## Copy and install sonic-mgmt docker dependencies
|
||||
COPY \
|
||||
{% for deb in docker_sonic_mgmt_debs.split(' ') -%}
|
||||
debs/{{ deb }}{{' '}}
|
||||
{%- endfor -%}
|
||||
debs/
|
||||
|
||||
RUN dpkg -i \
|
||||
{% for deb in docker_sonic_mgmt_debs.split(' ') -%}
|
||||
debs/{{ deb }}{{' '}}
|
||||
{%- endfor %}
|
||||
|
||||
RUN git clone https://github.com/ansible/ansible
|
||||
RUN cd ansible && git checkout v2.0.0.2-1 -b v2.0.0.2-1 && git submodule update --init --recursive && make && make install
|
||||
|
5
rules/docker-sonic-mgmt.mk
Normal file
5
rules/docker-sonic-mgmt.mk
Normal file
@ -0,0 +1,5 @@
|
||||
# docker image for sonic-mgmt
|
||||
DOCKER_SONIC_MGMT = docker-sonic-mgmt.gz
|
||||
$(DOCKER_SONIC_MGMT)_PATH = $(DOCKERS_PATH)/docker-sonic-mgmt
|
||||
$(DOCKER_SONIC_MGMT)_DEPENDS += $(SONIC_DEVICE_DATA)
|
||||
SONIC_DOCKER_IMAGES += $(DOCKER_SONIC_MGMT)
|
7
slave.mk
7
slave.mk
@ -6,6 +6,9 @@
|
||||
.ONESHELL:
|
||||
SHELL = /bin/bash
|
||||
.SHELLFLAGS += -e
|
||||
USER = $(shell id -un)
|
||||
UID = $(shell id -u)
|
||||
GUID = $(shell id -g)
|
||||
|
||||
.SECONDEXPANSION:
|
||||
|
||||
@ -297,7 +300,7 @@ docker-start :
|
||||
# targets for building simple docker images that do not depend on any debian packages
|
||||
$(addprefix $(TARGET_PATH)/, $(SONIC_SIMPLE_DOCKER_IMAGES)) : $(TARGET_PATH)/%.gz : .platform docker-start $$(addsuffix -load,$$(addprefix $(TARGET_PATH)/,$$($$*.gz_LOAD_DOCKERS)))
|
||||
$(HEADER)
|
||||
docker build --squash --no-cache -t $* $($*.gz_PATH) $(LOG)
|
||||
docker build --squash --no-cache --build-arg user=$(USER) --build-arg uid=$(UID) --build-arg guid=$(GUID) -t $* $($*.gz_PATH) $(LOG)
|
||||
docker save $* | gzip -c > $@
|
||||
$(FOOTER)
|
||||
|
||||
@ -313,7 +316,7 @@ $(addprefix $(TARGET_PATH)/, $(SONIC_DOCKER_IMAGES)) : $(TARGET_PATH)/%.gz : .pl
|
||||
$(eval export $(subst -,_,$(notdir $($*.gz_PATH)))_whls=$(shell printf "$(subst $(SPACE),\n,$(call expand,$($*.gz_PYTHON_WHEELS)))\n" | awk '!a[$$0]++'))
|
||||
$(eval export $(subst -,_,$(notdir $($*.gz_PATH)))_dbgs=$(shell printf "$(subst $(SPACE),\n,$(call expand,$($*.gz_DBG_PACKAGES)))\n" | awk '!a[$$0]++'))
|
||||
j2 $($*.gz_PATH)/Dockerfile.j2 > $($*.gz_PATH)/Dockerfile
|
||||
docker build --squash --no-cache -t $* $($*.gz_PATH) $(LOG)
|
||||
docker build --squash --no-cache --build-arg user=$(USER) --build-arg uid=$(UID) --build-arg guid=$(GUID) -t $* $($*.gz_PATH) $(LOG)
|
||||
docker save $* | gzip -c > $@
|
||||
$(FOOTER)
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user