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.
41 lines
1.4 KiB
Django/Jinja
41 lines
1.4 KiB
Django/Jinja
{% from "dockers/dockerfile-macros.j2" import install_debian_packages, install_python_wheels, copy_files %}
|
|
FROM docker-config-engine-bullseye-{{DOCKER_USERNAME}}:{{DOCKER_USERTAG}}
|
|
|
|
ARG docker_container_name
|
|
ARG image_version
|
|
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
|
|
|
|
# Pass the image_version to container
|
|
ENV IMAGE_VERSION=$image_version
|
|
|
|
# Update apt's cache of available packages
|
|
RUN apt-get update
|
|
|
|
# Install radvd Debian package
|
|
RUN apt-get -y install radvd
|
|
|
|
{% if docker_router_advertiser_debs.strip() -%}
|
|
# Copy built Debian packages
|
|
{{ copy_files("debs/", docker_router_advertiser_debs.split(' '), "/debs/") }}
|
|
|
|
# Install built Debian packages and implicitly install their dependencies
|
|
{{ install_debian_packages(docker_router_advertiser_debs.split(' ')) }}
|
|
{%- endif %}
|
|
|
|
# Clean up
|
|
RUN apt-get clean -y && \
|
|
apt-get autoclean -y && \
|
|
apt-get autoremove -y && \
|
|
rm -rf /debs
|
|
|
|
COPY ["start.sh", "/usr/bin/"]
|
|
COPY ["docker-init.sh", "/usr/bin/"]
|
|
COPY ["radvd.conf.j2", "wait_for_link.sh.j2", "docker-router-advertiser.supervisord.conf.j2", "/usr/share/sonic/templates/"]
|
|
COPY ["files/supervisor-proc-exit-listener", "/usr/bin"]
|
|
COPY ["critical_processes", "/etc/supervisor"]
|
|
|
|
ENTRYPOINT ["/usr/bin/docker-init.sh"]
|