-
Notifications
You must be signed in to change notification settings - Fork 144
/
Dockerfile
65 lines (48 loc) · 1.94 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
# Use multi-stage build
FROM node:16 as node-build
WORKDIR /app
# Copy package.json, package-lock.json, and webpack configuration
COPY attack-search/package*.json ./attack-search/
COPY attack-search/webpack.config.cjs ./attack-search/
# Copy src/ folder with all subdirectories
COPY attack-search/src ./attack-search/src
# Generate the webpack bundle containing the search service
RUN cd attack-search && \
npm ci && \
npm run build
# Use the official Python image as the base image
FROM python:3.10-slim-bullseye as python-build
ENV DEBIAN_FRONTEND noninteractive
ENV LANG en_US.UTF-8
ENV LC_ALL en_US.UTF-8
# Install dependencies
RUN apt-get update --fix-missing && \
apt-get upgrade -y && \
apt-get install -y -qq --no-install-recommends locales sudo git apt-transport-https ca-certificates && \
echo "en_US.UTF-8 UTF-8" > /etc/locale.gen && \
locale-gen && \
update-ca-certificates
WORKDIR /home/attackuser/attack-website
# Copy the source code
COPY . .
# Install all Python dependencies
RUN python3 -m pip install --no-cache-dir wheel && \
python3 -m pip install --no-cache-dir -r requirements.txt
# Build the website
RUN python3 update-attack.py --no-test-exitstatus
# Copy the search service webpack bundle from the node-build stage
COPY --from=node-build /app/attack-search/dist/search_bundle.js output/theme/scripts/search_bundle.js
# Nginx stage
FROM nginx:stable-alpine as production-stage
COPY --from=python-build /home/attackuser/attack-website/output /var/www/html
COPY nginx.conf /etc/nginx/conf.d/default.conf
# Label metadata
LABEL name="attack-website" \
description="Dockerfile for the ATT&CK Website" \
usage="https://github.com/mitre-attack/attack-website/blob/master/README.md#install-and-build" \
url="https://attack.mitre.org/" \
vcs-url="https://github.com/mitre-attack/attack-website" \
vendor="MITRE ATT&CK" \
maintainer="[email protected]"
EXPOSE 80
CMD ["nginx", "-g", "daemon off;"]