81cf33231f
- create a dockerfile-marcros.j2 file with all common operations written as j2 macro - use single dockerfile instruction for COPY and RUN commands when possible to improve build time - reorganize dockerfile instructions to make more cache friendly (in case someday we will remove --no-cache to build docker images) Signed-off-by: Stepan Blyschak <stepanb@mellanox.com>
19 lines
568 B
Django/Jinja
19 lines
568 B
Django/Jinja
{% macro install_debian_packages(packages) -%}
|
|
RUN dpkg_apt() { [ -f $1 ] && { dpkg -i $1 || apt-get -y install -f; } || return 1; }; \
|
|
{%- for deb in packages %}
|
|
dpkg_apt /debs/{{ deb }} {%- if not loop.last %} && \ {%- endif %}
|
|
{%- endfor %}
|
|
{%- endmacro %}
|
|
|
|
{% macro install_python_wheels(packages) -%}
|
|
RUN cd /python-wheels/ && pip install {{ packages | join(' ') }}
|
|
{%- endmacro %}
|
|
|
|
{% macro copy_files(prefix, files, dest) -%}
|
|
COPY \
|
|
{%- for file in files %}
|
|
{{ prefix }}/{{ file }} \
|
|
{%- endfor %}
|
|
{{ dest }}
|
|
{%- endmacro %}
|