-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDockerfile
95 lines (73 loc) · 3.38 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
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
FROM node:20-alpine AS base
RUN corepack enable
FROM base AS graphql-deps-builder
WORKDIR /opt/opencti-build/opencti-graphql
COPY opencti-graphql/package.json opencti-graphql/yarn.lock opencti-graphql/.yarnrc.yml ./
COPY opencti-graphql/.yarn ./.yarn
COPY opencti-graphql/patch ./patch
RUN set -ex; \
apk add --no-cache git tini gcc g++ make musl-dev cargo python3 python3-dev postfix postfix-pcre \
&& npm install -g node-gyp \
&& yarn install --frozen-lockfile && yarn cache clean --all
FROM base AS graphql-builder
WORKDIR /opt/opencti-build/opencti-graphql
COPY opencti-graphql/package.json opencti-graphql/yarn.lock opencti-graphql/.yarnrc.yml ./
COPY opencti-graphql/.yarn ./.yarn
COPY opencti-graphql/patch ./patch
RUN set -ex; \
apk add --no-cache git tini gcc g++ make musl-dev cargo python3 python3-dev postfix postfix-pcre \
&& rm -f /usr/lib/python3.11/EXTERNALLY-MANAGED \
&& rm -f /usr/lib/python3.12/EXTERNALLY-MANAGED \
&& npm install -g node-gyp \
&& yarn install
COPY opencti-graphql /opt/opencti-build/opencti-graphql
RUN yarn build:prod
FROM base AS front-builder
WORKDIR /opt/opencti-build/opencti-front
COPY opencti-front/package.json opencti-front/yarn.lock opencti-front/.yarnrc.yml ./
COPY opencti-front/.yarn ./.yarn
COPY opencti-front/patch ./patch
COPY opencti-front/packages ./packages
RUN set -ex; \
apk add --no-cache git tini gcc g++ make musl-dev cargo python3 python3-dev postfix postfix-pcre \
&& rm -f /usr/lib/python3.11/EXTERNALLY-MANAGED \
&& rm -f /usr/lib/python3.12/EXTERNALLY-MANAGED \
&& npm install -g node-gyp \
&& yarn install
COPY opencti-front /opt/opencti-build/opencti-front
COPY opencti-graphql/config/schema/opencti.graphql /opt/opencti-build/opencti-graphql/config/schema/opencti.graphql
RUN yarn build:standalone
FROM base AS app
RUN set -ex; \
apk add --no-cache git tini gcc g++ make musl-dev cargo python3 python3-dev postfix postfix-pcre \
&& rm -f /usr/lib/python3.11/EXTERNALLY-MANAGED \
&& rm -f /usr/lib/python3.12/EXTERNALLY-MANAGED \
&& python3 -m ensurepip \
&& rm -rv /usr/lib/python*/ensurepip \
&& pip3 install --no-cache-dir --upgrade pip setuptools wheel \
&& ln -sf python3 /usr/bin/python
WORKDIR /opt/opencti
COPY opencti-graphql/src/python/requirements.txt ./src/python/requirements.txt
RUN pip3 install --no-cache-dir --requirement ./src/python/requirements.txt \
&& pip3 install \
--no-cache-dir \
--upgrade \
--force 'git+https://github.com/OpenCTI-Platform/client-python@master' \
&& apk del git gcc musl-dev
COPY --from=graphql-deps-builder /opt/opencti-build/opencti-graphql/node_modules ./node_modules
COPY --from=graphql-builder /opt/opencti-build/opencti-graphql/build ./build
COPY --from=graphql-builder /opt/opencti-build/opencti-graphql/static ./static
COPY --from=front-builder /opt/opencti-build/opencti-front/builder/prod/build ./public
COPY opencti-graphql/src ./src
COPY opencti-graphql/config ./config
COPY opencti-graphql/script ./script
ENV PYTHONUNBUFFERED=1
ENV NODE_OPTIONS=--max_old_space_size=12288
ENV NODE_ENV=production
RUN set -ex; \
install -m 0777 -d '/opt/opencti/logs' \
&& install -m 0777 -d '/opt/opencti/telemetry' \
&& install -m 0777 -d '/opt/opencti/.support'
VOLUME ["/opt/opencti/logs", "/opt/opencti/telemetry", "/opt/opencti/.support"]
ENTRYPOINT ["/sbin/tini", "--"]
CMD ["node", "build/back.js"]