bc30528341
Currently, the build dockers are created as a user dockers(docker-base-stretch-<user>, etc) that are specific to each user. But the sonic dockers (docker-database, docker-swss, etc) are created with a fixed docker name and common to all the users. docker-database:latest docker-swss:latest When multiple builds are triggered on the same build server that creates parallel building issue because all the build jobs are trying to create the same docker with latest tag. This happens only when sonic dockers are built using native host dockerd for sonic docker image creation. This patch creates all sonic dockers as user sonic dockers and then, while saving and loading the user sonic dockers, it rename the user sonic dockers into correct sonic dockers with tag as latest. docker-database:latest <== SAVE/LOAD ==> docker-database-<user>:tag The user sonic docker names are derived from 'DOCKER_USERNAME and DOCKER_USERTAG' make env variable and using Jinja template, it replaces the FROM docker name with correct user sonic docker name for loading and saving the docker image.
95 lines
3.5 KiB
Django/Jinja
95 lines
3.5 KiB
Django/Jinja
FROM docker-config-engine-{{DOCKER_USERNAME}}:{{DOCKER_USERTAG}}
|
|
|
|
ARG docker_container_name
|
|
RUN [ -f /etc/rsyslog.conf ] && sed -ri "s/%syslogtag%/$docker_container_name#%syslogtag%/;" /etc/rsyslog.conf
|
|
|
|
## Make apt-get non-interactive
|
|
ENV DEBIAN_FRONTEND=noninteractive
|
|
|
|
COPY ["sonic-dev.gpg.key", "/etc/apt/"]
|
|
RUN apt-key add /etc/apt/sonic-dev.gpg.key
|
|
RUN echo "deb http://packages.microsoft.com/repos/sonic-dev/ jessie main" >> /etc/apt/sources.list
|
|
RUN apt-get update
|
|
|
|
RUN apt-get install -y net-tools \
|
|
arping \
|
|
ethtool \
|
|
tcpdump \
|
|
ifupdown \
|
|
jq \
|
|
bridge-utils \
|
|
python-ply \
|
|
libqt5core5a \
|
|
libqt5network5 \
|
|
libboost-program-options1.55.0 \
|
|
libboost-system1.55.0 \
|
|
libboost-thread1.55.0 \
|
|
libgmp10 \
|
|
libjudydebian1 \
|
|
libnanomsg0 \
|
|
libdaemon0 \
|
|
libjansson4 \
|
|
libatomic1 \
|
|
libjemalloc1 \
|
|
liblua5.1-0 \
|
|
lua-bitop \
|
|
lua-cjson \
|
|
openssh-client \
|
|
openssh-server \
|
|
libc-ares2 \
|
|
iproute \
|
|
libpython2.7 \
|
|
grub2-common \
|
|
bash-completion \
|
|
libelf1 \
|
|
libmnl0 \
|
|
# For installing Python m2crypto package
|
|
# (these can be uninstalled after installation)
|
|
build-essential \
|
|
python-dev \
|
|
python3-dev \
|
|
libssl-dev \
|
|
swig \
|
|
# For using Python m2crypto package
|
|
openssl
|
|
|
|
RUN pip install setuptools
|
|
RUN pip install py2_ipaddress
|
|
|
|
COPY \
|
|
{% for deb in docker_sonic_p4_debs.split(' ') -%}
|
|
debs/{{ deb }}{{' '}}
|
|
{%- endfor -%}
|
|
debs/
|
|
|
|
RUN dpkg -i \
|
|
{% for deb in docker_sonic_p4_debs.split(' ') -%}
|
|
debs/{{ deb }}{{' '}}
|
|
{%- endfor %}
|
|
|
|
## Clean up
|
|
RUN apt-get purge -y build-essential libssl-dev swig
|
|
RUN apt-get purge -y python-dev python3-dev
|
|
RUN apt-get clean -y; apt-get autoclean -y; apt-get autoremove -y
|
|
RUN rm -rf /debs
|
|
|
|
RUN sed -ri 's/^(save .*$)/# \1/g; \
|
|
s/^daemonize yes$/daemonize no/; \
|
|
s/^logfile .*$/logfile ""/; \
|
|
s/^# syslog-enabled no$/syslog-enabled no/; \
|
|
s/^# unixsocket/unixsocket/; \
|
|
s/notify-keyspace-events ""/notify-keyspace-events AKE/; \
|
|
s/^client-output-buffer-limit pubsub [0-9]+mb [0-9]+mb [0-9]+/client-output-buffer-limit pubsub 0 0 0/ \
|
|
' /etc/redis/redis.conf
|
|
|
|
ADD port_config.ini /port_config.ini
|
|
COPY ["start.sh", "orchagent.sh", "config_bm.sh", "/usr/bin/"]
|
|
COPY ["supervisord.conf", "/etc/supervisor/conf.d/"]
|
|
COPY ["files/configdb-load.sh", "/usr/bin/"]
|
|
COPY ["files/arp_update", "/usr/bin"]
|
|
COPY ["files/arp_update_vars.j2", "/usr/share/sonic/templates/"]
|
|
RUN echo "docker-sonic-p4" > /etc/hostname
|
|
RUN touch /etc/quagga/zebra.conf
|
|
|
|
ENTRYPOINT ["/bin/bash"]
|