This repository has been archived by the owner on Jan 15, 2024. It is now read-only.
forked from retspen/webvirtcloud
-
Notifications
You must be signed in to change notification settings - Fork 4
/
Dockerfile
58 lines (48 loc) · 1.58 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
FROM phusion/baseimage:jammy-1.0.1
EXPOSE 80
RUN echo 'APT::Get::Clean=always;' >> /etc/apt/apt.conf.d/99AutomaticClean
RUN apt-get update -qqy \
&& DEBIAN_FRONTEND=noninteractive apt-get -qyy install \
--no-install-recommends \
git \
python3-venv \
python3-dev \
python3-lxml \
libvirt-dev \
zlib1g-dev \
nginx \
pkg-config \
gcc \
libldap2-dev \
libssl-dev \
libsasl2-dev \
libsasl2-modules \
&& rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*
COPY . /srv/webvirtcloud
RUN mkdir -p /srv/webvirtcloud/data
RUN chown -R www-data:www-data /srv/webvirtcloud
RUN sed -i "/SECRET_KEY/c\SECRET_KEY = \"$(python3 /srv/webvirtcloud/webvirtcloud/secret_generator.py)\"" /srv/webvirtcloud/webvirtcloud/settings.py
# Setup webvirtcloud
WORKDIR /srv/webvirtcloud
RUN python3 -m venv venv && \
. venv/bin/activate && \
pip3 install -U pip && \
pip3 install wheel && \
pip3 install -r requirements.txt && \
pip3 cache purge && \
chown -R www-data:www-data /srv/webvirtcloud
RUN . venv/bin/activate && \
python3 manage.py makemigrations && \
python3 manage.py migrate && \
python3 manage.py collectstatic --noinput && \
chown -R www-data:www-data /srv/webvirtcloud
# Setup Nginx
RUN printf "\n%s" "daemon off;" >> /etc/nginx/nginx.conf && \
rm /etc/nginx/sites-enabled/default && \
chown -R www-data:www-data /var/lib/nginx
RUN ln -s /srv/webvirtcloud/webvirtcloud/nginx.conf /etc/nginx/conf.d/webvirtcloud.conf
# Define mountable directories.
VOLUME ["/srv/webvirtcloud/data","/var/www/.ssh"]
WORKDIR /srv/webvirtcloud
COPY entrypoint.sh /entrypoint.sh
ENTRYPOINT ["/entrypoint.sh"]