-
Notifications
You must be signed in to change notification settings - Fork 946
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[integration] Fix the build of FIPS 140-2 images
- Loading branch information
1 parent
bfa6943
commit cdc32a6
Showing
4 changed files
with
101 additions
and
13 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,93 @@ | ||
FROM filigran/python-nodejs-fips:latest AS base | ||
|
||
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 postfix postfix-pcre gettext-dev \ | ||
&& 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 postfix postfix-pcre gettext-dev \ | ||
&& 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 postfix postfix-pcre gettext-dev \ | ||
&& 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 postfix postfix-pcre \ | ||
&& pip3 install --no-cache-dir --upgrade pip setuptools wheel | ||
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 \ | ||
&& 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 | ||
|
||
ARG UID=10000 | ||
ARG GID=10001 | ||
ARG USERNAME="_opencti" | ||
|
||
ENV PYTHONUNBUFFERED=1 | ||
ENV NODE_OPTIONS="--force-fips --max_old_space_size=12288" | ||
ENV NODE_ENV=production | ||
|
||
RUN set -ex \ | ||
; addgroup -g "${GID}" -S "${USERNAME}" \ | ||
&& adduser \ | ||
-h /opt/opencti \ | ||
-g "OpenCTI privsep user" \ | ||
-s "/sbin/nologin" \ | ||
-G "${USERNAME}" \ | ||
-S \ | ||
-u "${UID}" \ | ||
"${USERNAME}" \ | ||
&& install -o "${UID}" -g "${GID}" -m 0750 -d '/opt/opencti/logs' | ||
|
||
VOLUME ["/opt/opencti/logs"] | ||
|
||
USER "${USERNAME}" | ||
|
||
ENTRYPOINT ["/sbin/tini", "--"] | ||
CMD ["node", "build/back.js"] |