-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathDockerfile
105 lines (95 loc) · 3.77 KB
/
Dockerfile
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
98
99
100
101
102
103
104
105
FROM ubuntu:20.04
ARG TARGETPLATFORM
ARG BUILDPLATFORM
RUN echo "I am running on $BUILDPLATFORM, building for $TARGETPLATFORM"
# Disable packer checkpoints. See: https://www.packer.io/docs/configure#full-list-of-environment-variables-usable-for-packer
ENV CHECKPOINT_DISABLE=1
# Install apt dependencies
RUN set -eux; \
apt-get update; \
apt-get install -y apt-transport-https ca-certificates gnupg2; \
apt-get clean; \
rm -rf /var/lib/apt/lists/*
# Install packer
RUN set -eux; \
buildDeps="curl gnupg2 software-properties-common"; \
apt-get update; \
apt-get install --no-install-recommends -y $buildDeps; \
curl -fsSL https://apt.releases.hashicorp.com/gpg | apt-key add -; \
apt-add-repository "deb [arch=amd64] https://apt.releases.hashicorp.com $(lsb_release -cs) main"; \
apt-get update; \
apt-get install --no-install-recommends -y packer=1.7.7 || apt-get install --no-install-recommends -y packer='1.7.7-*'; \
packer version; \
apt-get purge --auto-remove -y $buildDeps; \
apt-get clean; \
rm -rf /var/lib/apt/lists/*
# Install sops
RUN set -eux; \
buildDeps="wget"; \
apt-get update; \
apt-get install --no-install-recommends -y $buildDeps; \
wget -qO- https://github.com/mozilla/sops/releases/download/v3.7.3/sops-v3.7.3.linux > /usr/local/bin/sops; \
chmod +x /usr/local/bin/sops; \
sha256sum /usr/local/bin/sops | grep '^53aec65e45f62a769ff24b7e5384f0c82d62668dd96ed56685f649da114b4dbb '; \
sops --version; \
apt-get purge --auto-remove -y $buildDeps; \
apt-get clean; \
rm -rf /var/lib/apt/lists/*
# Install gnupg for sops
RUN set -eux; \
apt-get update; \
apt-get install --no-install-recommends -y gnupg2; \
apt-get clean; \
rm -rf /var/lib/apt/lists/*
# Install kvm. See: https://help.ubuntu.com/community/KVM/Installation
RUN set -eux; \
apt-get update; \
\
echo 'debconf debconf/frontend select Noninteractive' | debconf-set-selections; \
apt-get install -y --no-install-recommends qemu-kvm libvirt-daemon-system libvirt-clients bridge-utils; \
apt-get install -y ovmf; \
\
virt-host-validate || true; \
qemu-system-x86_64 --version; \
libvirtd --version; \
virsh --version; \
\
apt-get clean; \
rm -rf /var/lib/apt/lists/*
# Install basic tools
RUN set -eux; \
apt-get update; \
apt-get install --no-install-recommends -y sudo ca-certificates wget curl git rsync; \
apt-get clean; \
rm -rf /var/lib/apt/lists/*
# Install tools for .vhd, .vmdk
# Fix apt dialog: https://github.com/moby/moby/issues/27988#issuecomment-462809153
# Fix guestmount error 'supermin: failed to find a suitable kernel (host_cpu=x86_64)': https://github.com/steigr/docker-hipchat-server/issues/1
RUN set -eux; \
apt-get update; \
\
echo 'debconf debconf/frontend select Noninteractive' | debconf-set-selections; \
apt-get install --no-install-recommends -y libguestfs-tools; \
\
apt-get install --no-install-recommends -y linux-image-generic; \
\
apt-get clean; \
rm -rf /var/lib/apt/lists/*
# Install tools for .iso
RUN set -eux; \
apt-get update; \
apt-get install --no-install-recommends -y sudo isolinux squashfs-tools xorriso mkisofs; \
apt-get clean; \
rm -rf /var/lib/apt/lists/*
# Install tools for storage
# s3fs: https://github.com/s3fs-fuse/s3fs-fuse
# mc: https://min.io/download#/linux
RUN set -eux; \
apt-get update; \
apt-get install --no-install-recommends -y s3fs; \
apt-get clean; \
rm -rf /var/lib/apt/lists/*; \
\
wget -qO- https://dl.min.io/client/mc/release/linux-amd64/archive/mc.RELEASE.2021-10-07T04-19-58Z > /usr/local/bin/mc; \
chmod +x /usr/local/bin/mc; \
sha256sum /usr/local/bin/mc | grep '^aa58e16c74c38bc05ecf73bedee476eafb3a1c42ea1ac95635853b530a36be93 '