-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path__OLD__Dockerfile
More file actions
121 lines (106 loc) · 5.57 KB
/
__OLD__Dockerfile
File metadata and controls
121 lines (106 loc) · 5.57 KB
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
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
FROM debian:bookworm
ENV PVE_VERSION=8.2-2 \
SERVICE=pve-docker \
DEBIAN_FRONTEND=noninteractive
LABEL maintainer="docker-dario@neomediatech.it" \
org.label-schema.version=$PVE_VERSION \
org.label-schema.vcs-type=Git \
org.label-schema.vcs-url=https://github.com/Neomediatech/${SERVICE} \
org.label-schema.maintainer=Neomediatech
# set apt config
RUN echo 'APT::Get::Assume-Yes "1";' > /etc/apt/apt.conf.d/00-custom && \
echo 'APT::Install-Recommends "0";' >> /etc/apt/apt.conf.d/00-custom && \
echo 'APT::Install-Suggests "0";' >> /etc/apt/apt.conf.d/00-custom
# install base pkg
RUN apt-get update && \
apt-get dist-upgrade && \
apt-get install wget systemctl nano vim curl gnupg ca-certificates rsyslog net-tools iputils-ping tini && \
rm -rf /var/lib/apt/lists/* /tmp/*
# add PVE repository
RUN wget https://enterprise.proxmox.com/debian/proxmox-release-bookworm.gpg -O /etc/apt/trusted.gpg.d/proxmox-release-bookworm.gpg && \
echo "deb http://download.proxmox.com/debian/pve bookworm pve-no-subscription" > /etc/apt/sources.list.d/pve-free.list
RUN apt-get update && \
apt-get install initramfs-tools zfsutils-linux && \
rm -rf /var/lib/apt/lists/* /tmp/* && \
echo '#!/bin/bash' > /usr/sbin/update-initramfs && \
echo 'exit 0' >> /usr/sbin/update-initramfs && \
chmod +x /usr/sbin/update-initramfs
RUN apt-get update && \
apt-get install $(apt-cache depends proxmox-ve|awk '{print $2}'|while read x;do apt-cache depends $x 2>/dev/null|grep Depends|awk '{print $2}'|grep ^[[:alnum:]];done|sort|uniq|egrep -v "pve|proxmox|ifenslave|ifupdown2|qemu-server"|xargs) && \
rm -rf /var/lib/apt/lists/* /tmp/*
# repacked proxmox-ve & pve-manager
RUN apt-get update && \
rm -f /etc/apt/apt.conf.d/docker-clean && \
apt-get install proxmox-ve || echo ok && \
PVE_PKG="pve-manager" && \
PVE_VER="$(ls /var/cache/apt/archives/${PVE_PKG}_*.deb|awk -F_ '{print $2}')" && \
PVE_DEB1="${PVE_PKG}_${PVE_VER}_amd64.deb" && \
mkdir /tmp/${PVE_PKG} && \
dpkg -X /var/cache/apt/archives/${PVE_PKG}_${PVE_VER}_amd64.deb /tmp/${PVE_PKG}/ && \
dpkg -e /var/cache/apt/archives/${PVE_PKG}_${PVE_VER}_amd64.deb /tmp/${PVE_PKG}/DEBIAN && \
sed -i "s/ifupdown2 (>= 2.0.1-1+pve8) | ifenslave (>= 2.6),//g" /tmp/${PVE_PKG}/DEBIAN/control && \
sed -i "s/ifupdown2 (>= 3.0) | ifenslave (>= 2.6),//g" /tmp/${PVE_PKG}/DEBIAN/control && \
dpkg-deb -Zxz -b /tmp/${PVE_PKG}/ /tmp && \
PVE_PKG="proxmox-ve" && \
PVE_VER="$(ls /var/cache/apt/archives/${PVE_PKG}_*.deb|awk -F_ '{print $2}')" && \
PVE_DEB2="${PVE_PKG}_${PVE_VER}_all.deb" && \
mkdir /tmp/${PVE_PKG} && \
dpkg -X /var/cache/apt/archives/${PVE_PKG}_${PVE_VER}_all.deb /tmp/${PVE_PKG}/ && \
dpkg -e /var/cache/apt/archives/${PVE_PKG}_${PVE_VER}_all.deb /tmp/${PVE_PKG}/DEBIAN && \
sed -i "s/pve-kernel-helper,//g" /tmp/${PVE_PKG}/DEBIAN/control && \
sed -i "s/pve-kernel-5.15,//g" /tmp/${PVE_PKG}/DEBIAN/control && \
sed -i "s/proxmox-default-kernel, //g" /tmp/${PVE_PKG}/DEBIAN/control && \
dpkg-deb -Zxz -b /tmp/${PVE_PKG}/ /tmp && \
dpkg -i /tmp/${PVE_DEB1} && \
dpkg -i /tmp/${PVE_DEB2} && \
echo '#!/bin/sh' > /etc/kernel/postrm.d/zz-proxmox-boot && \
echo 'exit 0' >> /etc/kernel/postrm.d/zz-proxmox-boot && \
apt-mark hold proxmox-ve && \
apt-mark hold pve-manager && \
rm -f /etc/apt/apt.conf.d/*pve* /etc/kernel/postinst.d/* && \
echo '#!/bin/sh' > /var/lib/dpkg/info/ifupdown2.postinst && \
echo 'exit 0' >> /var/lib/dpkg/info/ifupdown2.postinst && \
apt-get -f install && \
apt-get autoremove --purge && \
apt-get purge ifupdown2 && \
apt-get install proxmox-backup-restore-image && \
rm -rf /var/lib/apt/lists/* /tmp/* && \
rm -f /etc/apt/sources.list.d/pve-enterprise.list
#set (temporary) password for root
RUN echo "root:root"|chpasswd
COPY entrypoint.sh /
RUN sed -i '/imklog/s/^/#/' /etc/rsyslog.conf && \
echo '*.* -/proc/1/fd/1' >> /etc/rsyslog.conf && \
chmod +x /entrypoint.sh
# Enabling rc.local to allow to execute installation of "ifupdown2" package after "init" is started.
# very bad and silly method! But didn't find other way.
# Networking must be restarted two times and "two times" ifupdown2 will be installed (very very bad! But it works)
RUN echo "[Unit] \n \
Description=/etc/rc.local Compatibility \n \
ConditionPathExists=/etc/rc.local \n \
[Service] \n \
Type=forking \n \
ExecStart=/etc/rc.local start \n \
TimeoutSec=0 \n \
StandardOutput=tty \n \
RemainAfterExit=yes \n \
\n \
[Install] \n \
WantedBy=multi-user.target" > /etc/systemd/system/rc-local.service && \
printf '%s\n' '#!/bin/bash' > /etc/rc.local && \
echo "systemctl restart networking" >> /etc/rc.local && \
echo "apt-get update" >> /etc/rc.local && \
echo "apt-get install -y --no-install-recommends --no-install-suggests ifupdown2" >> /etc/rc.local && \
echo "systemctl restart networking" >> /etc/rc.local && \
echo "apt-get install -y --no-install-recommends --no-install-suggests ifupdown2" >> /etc/rc.local && \
echo "exit 0" >> /etc/rc.local && \
chmod +x /etc/rc.local && \
mkdir -p /var/lib/dhcp && \
rm -rf /var/lib/apt/lists/* /tmp/*
RUN systemctl disable pvestatd pvefw-logger corosync spiceproxy getty@tty1 ssh.service pve-ha-lrm.service pve-ha-crm.service && \
systemctl disable pve-firewall.service pvescheduler.service spiceproxy.service || echo ok && \
systemctl enable rsyslog rc-local
#use setup.sh to start proxmox service
STOPSIGNAL SIGINT
ENTRYPOINT [ "/entrypoint.sh" ]
CMD [ "/lib/systemd/systemd", "log-level=info", "unit=sysinit.target"]