Move from sed to jinja2 for more readability.
This commit is contained in:
parent
aefefeff05
commit
66aebb329c
@ -2,17 +2,20 @@ FROM docker-base
|
|||||||
|
|
||||||
RUN apt-get update
|
RUN apt-get update
|
||||||
|
|
||||||
COPY deps/ deps
|
COPY debs/ debs
|
||||||
|
|
||||||
## Install redis-tools dependencies
|
## Install redis-tools dependencies
|
||||||
## TODO: implicitly install dependencies
|
## TODO: implicitly install dependencies
|
||||||
RUN apt-get -y install libjemalloc1
|
RUN apt-get -y install libjemalloc1
|
||||||
|
|
||||||
SED_DPKG
|
RUN dpkg -i \
|
||||||
|
{% for deb in docker_database_debs.split(' ') -%}
|
||||||
|
debs/{{ deb }}{{' '}}
|
||||||
|
{%- endfor %}
|
||||||
|
|
||||||
## Clean up
|
## Clean up
|
||||||
RUN apt-get clean -y; apt-get autoclean -y; apt-get autoremove -y
|
RUN apt-get clean -y; apt-get autoclean -y; apt-get autoremove -y
|
||||||
RUN rm -rf /deps
|
RUN rm -rf /debs
|
||||||
|
|
||||||
RUN sed -ri 's/^daemonize yes$/daemonize no/; \
|
RUN sed -ri 's/^daemonize yes$/daemonize no/; \
|
||||||
s/^logfile .*$/logfile ""/; \
|
s/^logfile .*$/logfile ""/; \
|
@ -4,13 +4,16 @@ RUN apt-get update
|
|||||||
|
|
||||||
RUN apt-get install -y libdbus-1-3 libdaemon0 libjansson4
|
RUN apt-get install -y libdbus-1-3 libdaemon0 libjansson4
|
||||||
|
|
||||||
COPY deps/ deps
|
COPY debs/ debs
|
||||||
|
|
||||||
SED_DPKG
|
RUN dpkg -i \
|
||||||
|
{% for deb in docker_fpm_debs.split(' ') -%}
|
||||||
|
debs/{{ deb }}{{' '}}
|
||||||
|
{%- endfor %}
|
||||||
|
|
||||||
## Clean up
|
## Clean up
|
||||||
RUN apt-get clean -y; apt-get autoclean -y; apt-get autoremove -y
|
RUN apt-get clean -y; apt-get autoclean -y; apt-get autoremove -y
|
||||||
RUN rm -rf /deps
|
RUN rm -rf /debs
|
||||||
|
|
||||||
COPY ["start.sh", "/usr/bin/"]
|
COPY ["start.sh", "/usr/bin/"]
|
||||||
|
|
@ -1,6 +1,6 @@
|
|||||||
FROM docker-base
|
FROM docker-base
|
||||||
|
|
||||||
COPY deps /deps
|
COPY debs /debs
|
||||||
COPY python-wheels /python-wheels
|
COPY python-wheels /python-wheels
|
||||||
|
|
||||||
RUN apt-get update && apt-get install -y python-pip supervisor libbsd0 libevent-2.0-5 libjansson4 libwrap0 libxml2 libpci3 libperl5.20
|
RUN apt-get update && apt-get install -y python-pip supervisor libbsd0 libevent-2.0-5 libjansson4 libwrap0 libxml2 libpci3 libperl5.20
|
||||||
@ -9,13 +9,16 @@ RUN apt-get update && apt-get install -y python-pip supervisor libbsd0 libevent-
|
|||||||
## Install Python SSWSDK
|
## Install Python SSWSDK
|
||||||
## Install LLDP Sync Daemon
|
## Install LLDP Sync Daemon
|
||||||
|
|
||||||
SED_DPKG
|
RUN dpkg -i \
|
||||||
|
{% for deb in docker_lldp_sv2_debs.split(' ') -%}
|
||||||
|
debs/{{ deb }}{{' '}}
|
||||||
|
{%- endfor %}
|
||||||
|
|
||||||
RUN pip install /python-wheels/sswsdk-2.0.1-py2-none-any.whl && \
|
RUN pip install /python-wheels/sswsdk-2.0.1-py2-none-any.whl && \
|
||||||
pip install /python-wheels/sonic_d-2.0.0-py2-none-any.whl && \
|
pip install /python-wheels/sonic_d-2.0.0-py2-none-any.whl && \
|
||||||
apt-get remove -y python-pip && \
|
apt-get remove -y python-pip && \
|
||||||
apt-get purge -y && apt-get autoclean -y && apt-get autoremove -y && \
|
apt-get purge -y && apt-get autoclean -y && apt-get autoremove -y && \
|
||||||
rm -rf /deps /python-wheels ~/.cache
|
rm -rf /debs /python-wheels ~/.cache
|
||||||
|
|
||||||
COPY supervisord.conf /etc/supervisor/conf.d/supervisord.conf
|
COPY supervisord.conf /etc/supervisor/conf.d/supervisord.conf
|
||||||
COPY reconfigure.sh /opt/reconfigure.sh
|
COPY reconfigure.sh /opt/reconfigure.sh
|
@ -8,15 +8,18 @@ RUN apt-get install -f -y ifupdown bridge-utils libdbus-1-3 libdaemon0 libjansso
|
|||||||
## TODO: implicitly install dependencies
|
## TODO: implicitly install dependencies
|
||||||
RUN apt-get -y install libjemalloc1
|
RUN apt-get -y install libjemalloc1
|
||||||
|
|
||||||
COPY deps /deps
|
COPY debs /debs
|
||||||
|
|
||||||
SED_DPKG
|
RUN dpkg -i \
|
||||||
|
{% for deb in docker_orchagent_debs.split(' ') -%}
|
||||||
|
debs/{{ deb }}{{' '}}
|
||||||
|
{%- endfor %}
|
||||||
|
|
||||||
COPY start.sh /usr/bin/start.sh
|
COPY start.sh /usr/bin/start.sh
|
||||||
|
|
||||||
## Clean up
|
## Clean up
|
||||||
RUN apt-get clean -y; apt-get autoclean -y; apt-get autoremove -y
|
RUN apt-get clean -y; apt-get autoclean -y; apt-get autoremove -y
|
||||||
RUN rm -rf /deps
|
RUN rm -rf /debs
|
||||||
|
|
||||||
ENTRYPOINT ["/bin/bash"]
|
ENTRYPOINT ["/bin/bash"]
|
||||||
CMD ["/usr/bin/start.sh"]
|
CMD ["/usr/bin/start.sh"]
|
@ -1,6 +1,6 @@
|
|||||||
FROM docker-base
|
FROM docker-base
|
||||||
|
|
||||||
COPY deps /deps
|
COPY debs /debs
|
||||||
COPY python-wheels /python-wheels
|
COPY python-wheels /python-wheels
|
||||||
|
|
||||||
# enable -O for all Python calls
|
# enable -O for all Python calls
|
||||||
@ -12,9 +12,12 @@ ENV PYTHONOPTIMIZE 1
|
|||||||
## Clean up
|
## Clean up
|
||||||
RUN apt-get update && apt-get install -y libmysqlclient-dev libmysqld-dev libperl-dev libpci-dev libpci3 libsensors4 libsensors4-dev libwrap0-dev
|
RUN apt-get update && apt-get install -y libmysqlclient-dev libmysqld-dev libperl-dev libpci-dev libpci3 libsensors4 libsensors4-dev libwrap0-dev
|
||||||
|
|
||||||
SED_DPKG
|
RUN dpkg -i \
|
||||||
|
{% for deb in docker_snmp_sv2_debs.split(' ') -%}
|
||||||
|
debs/{{ deb }}{{' '}}
|
||||||
|
{%- endfor %}
|
||||||
|
|
||||||
RUN rm -rf /deps
|
RUN rm -rf /debs
|
||||||
|
|
||||||
# install subagent
|
# install subagent
|
||||||
RUN apt-get -y install build-essential wget libssl-dev openssl supervisor && \
|
RUN apt-get -y install build-essential wget libssl-dev openssl supervisor && \
|
@ -2,14 +2,17 @@ FROM docker-base
|
|||||||
|
|
||||||
RUN apt-get update && apt-get install -f -y libdbus-1-3 libdaemon0 libjansson4
|
RUN apt-get update && apt-get install -f -y libdbus-1-3 libdaemon0 libjansson4
|
||||||
|
|
||||||
COPY deps /deps
|
COPY debs /debs
|
||||||
|
|
||||||
SED_DPKG
|
RUN dpkg -i \
|
||||||
|
{% for deb in docker_team_debs.split(' ') -%}
|
||||||
|
debs/{{ deb }}{{' '}}
|
||||||
|
{%- endfor %}
|
||||||
|
|
||||||
COPY start.sh /usr/bin/start.sh
|
COPY start.sh /usr/bin/start.sh
|
||||||
|
|
||||||
RUN apt-get clean -y; apt-get autoclean -y; apt-get autoremove -y
|
RUN apt-get clean -y; apt-get autoclean -y; apt-get autoremove -y
|
||||||
RUN rm -rf /deps
|
RUN rm -rf /debs
|
||||||
|
|
||||||
ENTRYPOINT ["/bin/bash"]
|
ENTRYPOINT ["/bin/bash"]
|
||||||
CMD ["/usr/bin/start.sh"]
|
CMD ["/usr/bin/start.sh"]
|
@ -2,18 +2,21 @@ FROM docker-base
|
|||||||
|
|
||||||
RUN apt-get update
|
RUN apt-get update
|
||||||
|
|
||||||
COPY deps /deps
|
COPY debs /debs
|
||||||
|
|
||||||
SED_DPKG
|
RUN dpkg -i \
|
||||||
|
{% for deb in docker_syncd_brcm_debs.split(' ') -%}
|
||||||
|
debs/{{ deb }}{{' '}}
|
||||||
|
{%- endfor %}
|
||||||
|
|
||||||
## TODO: add kmod into Depends
|
## TODO: add kmod into Depends
|
||||||
RUN apt-get install -f kmod
|
RUN apt-get install -f kmod
|
||||||
|
|
||||||
COPY ["deps/dsserve", "deps/bcmcmd", "start.sh", "/usr/bin/"]
|
COPY ["debs/dsserve", "debs/bcmcmd", "start.sh", "/usr/bin/"]
|
||||||
|
|
||||||
## Clean up
|
## Clean up
|
||||||
RUN apt-get clean -y; apt-get autoclean -y; apt-get autoremove -y
|
RUN apt-get clean -y; apt-get autoclean -y; apt-get autoremove -y
|
||||||
RUN rm -rf /deps
|
RUN rm -rf /debs
|
||||||
|
|
||||||
ENTRYPOINT ["/bin/bash"]
|
ENTRYPOINT ["/bin/bash"]
|
||||||
CMD ["/usr/bin/start.sh"]
|
CMD ["/usr/bin/start.sh"]
|
@ -2,19 +2,22 @@ FROM docker-base
|
|||||||
|
|
||||||
RUN apt-get update
|
RUN apt-get update
|
||||||
|
|
||||||
COPY deps /deps
|
COPY debs /debs
|
||||||
|
|
||||||
RUN apt-get install -y libxml2
|
RUN apt-get install -y libxml2
|
||||||
|
|
||||||
SED_DPKG
|
RUN dpkg -i \
|
||||||
|
{% for deb in docker_syncd_mlnx_debs.split(' ') -%}
|
||||||
|
debs/{{ deb }}{{' '}}
|
||||||
|
{%- endfor %}
|
||||||
|
|
||||||
COPY ["start.sh", "/usr/bin/"]
|
COPY ["start.sh", "/usr/bin/"]
|
||||||
COPY ["mlnx-fw-upgrade.sh", "/usr/bin/"]
|
COPY ["mlnx-fw-upgrade.sh", "/usr/bin/"]
|
||||||
COPY ["/deps/fw-SPC.mfa", "/etc/mlnx/"]
|
COPY ["/debs/fw-SPC.mfa", "/etc/mlnx/"]
|
||||||
|
|
||||||
## Clean up
|
## Clean up
|
||||||
RUN apt-get clean -y; apt-get autoclean -y; apt-get autoremove -y
|
RUN apt-get clean -y; apt-get autoclean -y; apt-get autoremove -y
|
||||||
RUN rm -rf /deps
|
RUN rm -rf /debs
|
||||||
|
|
||||||
ENTRYPOINT ["/bin/bash"]
|
ENTRYPOINT ["/bin/bash"]
|
||||||
CMD ["/usr/bin/start.sh"]
|
CMD ["/usr/bin/start.sh"]
|
@ -4,9 +4,12 @@ RUN apt-get update
|
|||||||
|
|
||||||
RUN apt-get install -y net-tools ethtool tcpdump ifupdown bridge-utils python-ply libqt5core5a libqt5network5 libboost-program-options1.55.0 libboost-system1.55.0 libboost-thread1.55.0 libgmp10 libjudydebian1 libnanomsg0 libdaemon0 libjansson4 libjemalloc1
|
RUN apt-get install -y net-tools ethtool tcpdump ifupdown bridge-utils python-ply libqt5core5a libqt5network5 libboost-program-options1.55.0 libboost-system1.55.0 libboost-thread1.55.0 libgmp10 libjudydebian1 libnanomsg0 libdaemon0 libjansson4 libjemalloc1
|
||||||
|
|
||||||
COPY deps /deps
|
COPY debs /debs
|
||||||
|
|
||||||
SED_DPKG
|
RUN dpkg -i \
|
||||||
|
{% for deb in docker_sonic_p4_debs.split(' ') -%}
|
||||||
|
debs/{{ deb }}{{' '}}
|
||||||
|
{%- endfor %}
|
||||||
|
|
||||||
ADD port_config.ini /port_config.ini
|
ADD port_config.ini /port_config.ini
|
||||||
ADD startup.sh /scripts/startup.sh
|
ADD startup.sh /scripts/startup.sh
|
||||||
@ -15,7 +18,7 @@ ADD rsyslog.conf /etc/rsyslog.conf
|
|||||||
|
|
||||||
## Clean up
|
## Clean up
|
||||||
RUN apt-get clean -y; apt-get autoclean -y; apt-get autoremove -y
|
RUN apt-get clean -y; apt-get autoclean -y; apt-get autoremove -y
|
||||||
RUN rm -rf /deps
|
RUN rm -rf /debs
|
||||||
|
|
||||||
RUN sed -ri 's/^daemonize yes$/daemonize no/; \
|
RUN sed -ri 's/^daemonize yes$/daemonize no/; \
|
||||||
s/^logfile .*$/logfile ""/; \
|
s/^logfile .*$/logfile ""/; \
|
10
slave.mk
10
slave.mk
@ -248,13 +248,15 @@ $(addprefix $(TARGET_PATH)/, $(SONIC_SIMPLE_DOCKER_IMAGES)) : $(TARGET_PATH)/%.g
|
|||||||
$(FOOTER)
|
$(FOOTER)
|
||||||
|
|
||||||
# Targets for building docker images
|
# Targets for building docker images
|
||||||
$(addprefix $(TARGET_PATH)/, $(SONIC_DOCKER_IMAGES)) : $(TARGET_PATH)/%.gz : .platform docker-start $$(addprefix $(DEBS_PATH)/,$$($$*.gz_DEPENDS) $$($$*.gz_FILES)) $$(addprefix $(PYTHON_WHEELS_PATH)/,$$($$*.gz_PYTHON_WHEELS)) $$(addsuffix -load,$$(addprefix $(TARGET_PATH)/,$$($$*.gz_LOAD_DOCKERS)))
|
$(addprefix $(TARGET_PATH)/, $(SONIC_DOCKER_IMAGES)) : $(TARGET_PATH)/%.gz : .platform docker-start $$(addprefix $(DEBS_PATH)/,$$($$*.gz_DEPENDS) $$($$*.gz_FILES)) $$(addprefix $(PYTHON_WHEELS_PATH)/,$$($$*.gz_PYTHON_WHEELS)) $$(addsuffix -load,$$(addprefix $(TARGET_PATH)/,$$($$*.gz_LOAD_DOCKERS))) $$($$*.gz_PATH)/Dockerfile.j2
|
||||||
$(HEADER)
|
$(HEADER)
|
||||||
mkdir -p $($*.gz_PATH)/deps $(LOG)
|
mkdir -p $($*.gz_PATH)/debs $(LOG)
|
||||||
mkdir -p $($*.gz_PATH)/python-wheels $(LOG)
|
mkdir -p $($*.gz_PATH)/python-wheels $(LOG)
|
||||||
sudo mount --bind $(DEBS_PATH) $($*.gz_PATH)/deps $(LOG)
|
sudo mount --bind $(DEBS_PATH) $($*.gz_PATH)/debs $(LOG)
|
||||||
sudo mount --bind $(PYTHON_WHEELS_PATH) $($*.gz_PATH)/python-wheels $(LOG)
|
sudo mount --bind $(PYTHON_WHEELS_PATH) $($*.gz_PATH)/python-wheels $(LOG)
|
||||||
sed 's/SED_DPKG/RUN cd deps \&\& dpkg -i $(shell printf "$(subst $(SPACE),\n,$(call expand,$($*.gz_DEPENDS),RDEPENDS))\n" | awk '!a[$$0]++')/g' $($*.gz_PATH)/Dockerfile.template > $($*.gz_PATH)/Dockerfile
|
# Export variables for j2. Use path for unique variable names, e.g. docker_orchagent_debs
|
||||||
|
$(eval export $(subst -,_,$(notdir $($*.gz_PATH)))_debs=$(shell printf "$(subst $(SPACE),\n,$(call expand,$($*.gz_DEPENDS),RDEPENDS))\n" | awk '!a[$$0]++'))
|
||||||
|
j2 $($*.gz_PATH)/Dockerfile.j2 > $($*.gz_PATH)/Dockerfile
|
||||||
docker build --no-cache -t $* $($*.gz_PATH) $(LOG)
|
docker build --no-cache -t $* $($*.gz_PATH) $(LOG)
|
||||||
docker save $* | gzip -c > $@
|
docker save $* | gzip -c > $@
|
||||||
$(FOOTER)
|
$(FOOTER)
|
||||||
|
Loading…
Reference in New Issue
Block a user