2019-06-22 13:26:23 -05:00
|
|
|
{% 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 %}
|
|
|
|
|
2020-09-29 15:57:54 -05:00
|
|
|
{% macro install_python2_wheels(packages) -%}
|
2020-10-26 15:48:50 -05:00
|
|
|
RUN cd /python-wheels/ && pip2 install {{ packages | join(' ') }}
|
2019-06-22 13:26:23 -05:00
|
|
|
{%- endmacro %}
|
|
|
|
|
2020-05-14 12:23:37 -05:00
|
|
|
{% macro install_python3_wheels(packages) -%}
|
|
|
|
RUN cd /python-wheels/ && pip3 install {{ packages | join(' ') }}
|
|
|
|
{%- endmacro %}
|
|
|
|
|
2020-09-29 15:57:54 -05:00
|
|
|
{% macro install_python_wheels(packages) -%}
|
|
|
|
{%- set py2_pkgs, py3_pkgs = [], [] %}
|
|
|
|
{%- for pkg in packages %}
|
|
|
|
{%- if 'py3' in pkg %}
|
|
|
|
{{- py3_pkgs.append(pkg) or '' }}
|
|
|
|
{%- else %}
|
|
|
|
{{- py2_pkgs.append(pkg) or '' }}
|
|
|
|
{%- endif %}
|
|
|
|
{%- endfor %}
|
|
|
|
{%- if py3_pkgs | length %}
|
|
|
|
{{ install_python3_wheels(py3_pkgs) }}
|
|
|
|
{%- endif %}
|
|
|
|
{%- if py2_pkgs | length %}
|
|
|
|
{{ install_python2_wheels(py2_pkgs) }}
|
|
|
|
{%- endif %}
|
|
|
|
{%- endmacro %}
|
|
|
|
|
2019-06-22 13:26:23 -05:00
|
|
|
{% macro copy_files(prefix, files, dest) -%}
|
|
|
|
COPY \
|
|
|
|
{%- for file in files %}
|
|
|
|
{{ prefix }}/{{ file }} \
|
|
|
|
{%- endfor %}
|
|
|
|
{{ dest }}
|
|
|
|
{%- endmacro %}
|
2023-03-22 16:51:25 -05:00
|
|
|
|
|
|
|
{% macro cleanup_apt_and_python_cache() -%}
|
|
|
|
RUN apt-get clean -y && \
|
|
|
|
apt-get autoclean -y && \
|
|
|
|
apt-get autoremove -y && \
|
|
|
|
rm -rf /debs /python-wheels /tmp/* ~/.cache /var/lib/apt/lists/*
|
|
|
|
{%- endmacro %}
|