Debian Codegraph @

Dockerfile

raw
1 # This implicitly includes Python 3.10
2 FROM node:14-alpine
3
4 # Do not use --update since that will also fetch the
5 # latest node-current package
6 # 'make' is needed for building documentation
7 RUN apk add npm make py3-pip py3-wheel
8
9 # Add an extra verification that we have the right node
10 # because the above caused issues
11 RUN node -v && node -v | grep -q v14 &&\
12 python3 --version && python3 --version | grep -q "3.10"
13
14 RUN pip install pip --upgrade
15
16 RUN mkdir -p /project/src/ &&\
17 mkdir -p /project/docs/build/ &&\
18 mkdir -p /project-minimal-copy/sphinx_rtd_theme &&\
19 touch /project-minimal-copy/sphinx_rtd_theme/__init__.py
20
21 # This is the main working directory where node_modules
22 # gets built. During runtime, it's mixed with directories
23 # from an external environment through a bind mount
24 WORKDIR /project
25
26 # Copy files necessary to run "npm install" and save
27 # installed packages in the docker image (makes the runtime
28 # so much faster)
29 COPY package.json /project/
30 COPY bin/preinstall.js /project/bin/preinstall.js
31
32 RUN cd /project
33
34 # It matters that the node environment is installed into the same
35 # folder, i.e. /project where we will run the environment from
36 # TODO: We don't want to update package-lock.json here, we
37 # should use npm ci instead
38 RUN npm install --package-lock-only &&\
39 npm audit fix &&\
40 npm install
41
42 # This is strictly speaking not necessary, just makes
43 # running the container faster...
44 # Install dependencies, then uninstall project itself
45 COPY setup.py README.rst /project-minimal-copy/
46 RUN cd /project-minimal-copy &&\
47 pip install ".[dev]" &&\
48 /usr/bin/yes | pip uninstall sphinx_rtd_theme
49
50
51 # Copy in files that we need to run the project. These files
52 # will not be mounted into the runtime from external environment
53 # so we copy them during build.
54 COPY webpack.common.js webpack.dev.js webpack.prod.js /project/
55
56 # Copy in the entrypoint and we're done
57 COPY docker-entrypoint.sh /entrypoint.sh
58 RUN chmod +x /entrypoint.sh
59
60 ENTRYPOINT ["/entrypoint.sh"]