summaryrefslogtreecommitdiffstats
path: root/taskcluster/docker/debian-raw/Dockerfile
blob: 7dce7ccf216c9fc0acb6d0a540b6c6d00181e728 (plain)
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
ARG BASE_IMAGE
FROM $BASE_IMAGE
MAINTAINER Mike Hommey <mhommey@mozilla.com>

ENV DEBIAN_FRONTEND=noninteractive

# Set a default command useful for debugging
CMD ["/bin/bash", "--login"]

# %include taskcluster/docker/recipes/setup_packages.sh
COPY topsrcdir/taskcluster/docker/recipes/setup_packages.sh /usr/local/sbin/
# %include taskcluster/docker/recipes/clean_packages.sh
COPY topsrcdir/taskcluster/docker/recipes/clean_packages.sh /usr/local/sbin/

COPY taskcluster-hack.sh /usr/local/sbin
COPY snapshot-hack.py /usr/local/sbin
COPY gpgvnoexpkeysig /usr/local/sbin

ARG DIST
ARG SNAPSHOT
ARG TASKCLUSTER_ROOT_URL
# Set apt sources list to a snapshot.
# Note: the use of gpgvnoexpkeysig is because the Debian Jessie GPG key expired.
RUN if [ -n "$DIST" ]; then for s in debian_$DIST debian_$DIST-updates debian_$DIST-backports debian-security_$DIST-security debian-debug_$DIST-debug debian-debug_$DIST-proposed-updates-debug debian-debug_$DIST-backports-debug; do \
      case "$s" in \
      debian-debug_jessie*|debian_jessie-updates) \
          : No debian-debug/updates archive for Jessie; \
          ;; \
      debian-security_jessie-security) \
          echo "deb http://archive.debian.org/debian-security/ jessie/updates main"; \
          ;; \
      debian*_jessie*) \
          echo "deb http://archive.debian.org/${s%_*}/ ${s#*_} main"; \
          ;; \
      debian-security_buster-security) \
          d=${s#*_}; \
          echo "deb http://snapshot.debian.org/archive/${s%_*}/$SNAPSHOT/ ${d%-security}/updates main"; \
          ;; \
      *) \
          echo "deb http://snapshot.debian.org/archive/${s%_*}/$SNAPSHOT/ ${s#*_} main"; \
          ;; \
      esac; \
    done > /etc/apt/sources.list ; fi && \
    rm -f /etc/apt/sources.list.d/* && \
    ( echo 'quiet "true";'; \
      echo 'APT::Get::Assume-Yes "true";'; \
      echo 'APT::Install-Recommends "false";'; \
      echo 'Acquire::Check-Valid-Until "false";'; \
      echo 'Acquire::Retries "5";'; \
      if dpkg --compare-versions $(apt --version | awk '{print $2}') ge 2.1.15; then \
        echo 'dir::bin::methods::https "/usr/local/sbin/taskcluster-hack.sh";'; \
      fi; \
      if [ "$DIST" = "jessie" ]; then \
        echo 'Dir::Bin::gpg "/usr/local/sbin/gpgvnoexpkeysig";'; \
      fi; \
    ) > /etc/apt/apt.conf.d/99taskcluster && \
    ( echo 'Package: *'; \
      echo 'Pin: origin "'$TASKCLUSTER_ROOT_URL'"' | sed 's,https://,,'; \
      echo 'Pin-Priority: 1001'; \
    ) > /etc/apt/preferences.d/99taskcluster

RUN apt-get update && \
    if grep -q snapshot.debian.org /etc/apt/sources.list; then \
      apt-get install python3-minimal libpython3-stdlib; \
      echo 'dir::bin::methods::http "/usr/local/sbin/snapshot-hack.py";' >> /etc/apt/apt.conf.d/99taskcluster; \
    fi && \
    apt-get dist-upgrade && \
    apt-get install \
      apt-transport-https \
      ca-certificates