-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
54 lines (43 loc) · 1.31 KB
/
Copy pathDockerfile
File metadata and controls
54 lines (43 loc) · 1.31 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
# dockerfile for the rootkit detector
# multi-stage build for the django app
# runs on ubuntu, need chkrootkit installed
FROM ubuntu:22.04
# no interactive prompts when installing packages
ENV DEBIAN_FRONTEND=noninteractive
# system deps
RUN apt-get update && apt-get install -y \
python3 \
python3-pip \
python3-venv \
chkrootkit \
net-tools \
iproute2 \
procps \
dnsutils \
sudo \
&& rm -rf /var/lib/apt/lists/*
# working dir
WORKDIR /app
# copy reqs first for caching layers
COPY requirements.txt .
RUN pip3 install --no-cache-dir -r requirements.txt
# copy the rest of the code
COPY . .
# make bash scripts executable
RUN chmod +x scripts/*.sh
# env vars
ENV PYTHONDONTWRITEBYTECODE=1
ENV PYTHONUNBUFFERED=1
ENV DJANGO_SETTINGS_MODULE=security_hub.settings
# init db and create the default admin user
RUN python3 manage.py migrate && \
DJANGO_SUPERUSER_PASSWORD=admin123 \
python3 manage.py createsuperuser --noinput --username admin --email admin@localhost && \
python3 dashboard/fix_dates.py
# expose port 8000
EXPOSE 8000
# healthcheck so docker knows it's alive
HEALTHCHECK --interval=30s --timeout=5s --retries=3 \
CMD curl -f http://localhost:8000/dashboard/login/ || exit 1
# run dev server
CMD ["python3", "manage.py", "runserver", "0.0.0.0:8000", "--noreload"]