juice-shop
/
Dockerfile
51 строка · 2.0 Кб
1FROM node:20-buster as installer
2COPY . /juice-shop
3WORKDIR /juice-shop
4RUN npm i -g typescript ts-node
5RUN npm install --omit=dev --unsafe-perm
6RUN npm dedupe --omit=dev
7RUN rm -rf frontend/node_modules
8RUN rm -rf frontend/.angular
9RUN rm -rf frontend/src/assets
10RUN mkdir logs
11RUN chown -R 65532 logs
12RUN chgrp -R 0 ftp/ frontend/dist/ logs/ data/ i18n/
13RUN chmod -R g=u ftp/ frontend/dist/ logs/ data/ i18n/
14RUN rm data/chatbot/botDefaultTrainingData.json || true
15RUN rm ftp/legal.md || true
16RUN rm i18n/*.json || true
17
18ARG CYCLONEDX_NPM_VERSION=latest
19RUN npm install -g @cyclonedx/cyclonedx-npm@$CYCLONEDX_NPM_VERSION
20RUN npm run sbom
21
22# workaround for libxmljs startup error
23FROM node:20-buster as libxmljs-builder
24WORKDIR /juice-shop
25RUN apt-get update && apt-get install -y build-essential python3
26COPY --from=installer /juice-shop/node_modules ./node_modules
27RUN rm -rf node_modules/libxmljs/build && \
28cd node_modules/libxmljs && \
29npm run build
30
31FROM gcr.io/distroless/nodejs20-debian11
32ARG BUILD_DATE
33ARG VCS_REF
34LABEL maintainer="Bjoern Kimminich <bjoern.kimminich@owasp.org>" \
35org.opencontainers.image.title="OWASP Juice Shop" \
36org.opencontainers.image.description="Probably the most modern and sophisticated insecure web application" \
37org.opencontainers.image.authors="Bjoern Kimminich <bjoern.kimminich@owasp.org>" \
38org.opencontainers.image.vendor="Open Worldwide Application Security Project" \
39org.opencontainers.image.documentation="https://help.owasp-juice.shop" \
40org.opencontainers.image.licenses="MIT" \
41org.opencontainers.image.version="17.1.0" \
42org.opencontainers.image.url="https://owasp-juice.shop" \
43org.opencontainers.image.source="https://github.com/juice-shop/juice-shop" \
44org.opencontainers.image.revision=$VCS_REF \
45org.opencontainers.image.created=$BUILD_DATE
46WORKDIR /juice-shop
47COPY --from=installer --chown=65532:0 /juice-shop .
48COPY --chown=65532:0 --from=libxmljs-builder /juice-shop/node_modules/libxmljs ./node_modules/libxmljs
49USER 65532
50EXPOSE 3000
51CMD ["/juice-shop/build/app.js"]
52