|
|
FROM ubuntu:22.04 |
|
|
|
|
|
# Set environment |
|
|
ENV |
|
|
ENV |
|
|
ENV |
|
|
ENV |
|
|
|
|
|
# Install |
|
|
RUN |
|
|
software-properties-common |
|
|
postgresql |
|
|
postgresql-contrib |
|
|
python3 |
|
|
python3-pip |
|
|
python3-venv |
|
|
nginx |
|
|
supervisor |
|
|
net-tools |
|
|
bridge-utils |
|
|
vlan |
|
|
iptables |
|
|
dnsmasq |
|
|
openvswitch-switch |
|
|
qemu-kvm |
|
|
libvirt-daemon-system |
|
|
libvirt-clients |
|
|
curl |
|
|
wget |
|
|
gnupg2 |
|
|
lsb-release |
|
|
&& rm /var//apt//* |
|
|
|
|
|
# Add MAAS PPA and install MAAS |
|
|
RUN add-apt-repository ppa:maas/ |
|
|
apt-get |
|
|
apt-get |
|
|
rm /var//apt//* |
|
|
|
|
|
# Create Python virtual environment |
|
|
RUN python3 -m venv //maas-env |
|
|
ENV PATH= |
|
|
|
|
|
# Install Python dependencies |
|
|
COPY requirements.txt // |
|
|
RUN pip install --no-cache-dir -r //requirements.txt |
|
|
|
|
|
# Create necessary directories |
|
|
RUN mkdir -p //maas-config //log/ /opt/ |
|
|
|
|
|
# Copy |
|
|
COPY / //maas-config/ |
|
|
COPY / //scripts/ |
|
|
COPY /etc//conf.d/ |
|
|
|
|
|
# Set |
|
|
RUN |
|
|
sudo |
|
|
sudo |
|
|
sudo |
|
|
|
|
|
# Initialize |
|
|
RUN |
|
|
maas ///$MAAS_DBNAME && \ |
|
|
maas createadmin --username admin --password admin --email admin@example.com |
|
|
|
|
|
# Expose ports |
|
|
EXPOSE 5240 5241 5242 5243 5248 5250 67 53 80 443 8080 9090 |
|
|
|
|
|
# Set working directory |
|
|
WORKDIR //scripts |
|
|
|
|
|
# Start supervisor |
|
|
CMD [, , ] |