-
Notifications
You must be signed in to change notification settings - Fork 3
/
Dockerfile.in
97 lines (80 loc) · 3.13 KB
/
Dockerfile.in
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
FROM {{base}}
# Install a few packages so that the OCF apt key can be added and so that any
# pre-package installation commands work + support https mirrors
RUN apt-get update \
&& DEBIAN_FRONTEND=noninteractive apt-get install --no-install-recommends -y \
ca-certificates curl gnupg apt-transport-https \
&& rm -rf /var/lib/apt/lists/*
{% if base != 'debian:bookworm' %}
# use mirrors.ocf.berkeley.edu (https)
RUN sed -ri 's!http\:\/\/(httpredir|deb)\.debian\.org!https\:\/\/mirrors.ocf.berkeley.edu!g; \
s!http\:\/\/security\.debian\.org!https\:\/\/mirrors.ocf.berkeley.edu!g' \
/etc/apt/sources.list
{% else %}
RUN sed -ri 's!http\:\/\/(httpredir|deb)\.debian\.org!https\:\/\/mirrors.ocf.berkeley.edu!g; \
s!http\:\/\/security\.debian\.org!https\:\/\/mirrors.ocf.berkeley.edu!g' \
/etc/apt/sources.list.d/debian.sources
{% endif %}
{% if ocf_apt_repo_dist %}
# add ocf apt repo
RUN curl https://apt.ocf.berkeley.edu/pubkey.gpg | apt-key add - && \
echo 'deb https://apt.ocf.berkeley.edu/ {{ocf_apt_repo_dist}} main' \
>> /etc/apt/sources.list
{% endif %}
{% if backport_dist %}
RUN echo 'Package: *\nPin: release n={{backport_dist}}\nPin-Priority: 200' \
> /etc/apt/preferences.d/backports.pref
RUN echo 'deb https://mirrors.ocf.berkeley.edu/debian/ {{backport_dist}} main' \
>> /etc/apt/sources.list
{% if ocf_apt_repo_dist %}
RUN echo 'deb https://apt.ocf.berkeley.edu/ {{backport_dist}} main' \
>> /etc/apt/sources.list
{% endif %}
{% endif %}
# add deb-src entries
RUN sed 's/^deb /deb-src /' /etc/apt/sources.list >> /etc/apt/sources.list
# Run package installation after all apt repos have been added
{% if packages %}
RUN apt-get update \
&& DEBIAN_FRONTEND=noninteractive apt-get upgrade -y \
&& DEBIAN_FRONTEND=noninteractive apt-get install --no-install-recommends -y \
{% for package in packages|sort %} {{package}} {% endfor %} \
&& rm -rf /var/lib/apt/lists/* \
&& apt-get clean
{% endif %}
{% if dumb_init_version %}
RUN curl -sLo /tmp/dumb-init.deb \
https://github.com/Yelp/dumb-init/releases/download/v{{dumb_init_version}}/dumb-init_{{dumb_init_version}}_amd64.deb \
&& dpkg -i /tmp/dumb-init.deb \
&& rm /tmp/dumb-init.deb \
&& apt-get clean
ENTRYPOINT ["/usr/bin/dumb-init", "--"]
{% endif %}
{% if ldap %}
COPY libnss-ldap.conf /etc/
COPY nsswitch.conf /etc/
COPY ldap.conf /etc/
RUN mkdir -p /etc/ldap/ && ln -fs /etc/ldap.conf /etc/ldap/ldap.conf
{% endif %}
{% if kerberos %}
COPY krb5.conf /etc/
{% endif %}
{% if mail %}
COPY ssmtp.conf /etc/ssmtp/
{% endif %}
RUN mkdir /opt/share
{% if utils %}
RUN mkdir /opt/share/utils
RUN curl -sL https://github.com/ocf/utils/archive/master.tar.gz | tar -C /opt/share/utils --strip-components=1 -xzf-
{% endif %}
# Set locale
RUN echo 'en_US.UTF-8 UTF-8' > /etc/locale.gen
RUN /usr/sbin/locale-gen
ENV LANG en_US.UTF-8
# Set timezone through a workaround
# https://bugs.launchpad.net/ubuntu/+source/tzdata/+bug/1554806
RUN ln -fs /usr/share/zoneinfo/US/Pacific /etc/localtime
RUN dpkg-reconfigure -f noninteractive tzdata
COPY incommon-intermediate.crt /etc/ssl/certs/
CMD ["/bin/bash"]
# vim: ft=jinja