|
| 1 | +# This implicitely 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 | +RUN npm install --package-lock-only &&\ |
| 37 | + npm audit fix &&\ |
| 38 | + npm install |
| 39 | + |
| 40 | +# This is strictly speaking not necessary, just makes |
| 41 | +# running the container faster... |
| 42 | +# Install dependencies, then uninstall project itself |
| 43 | +COPY setup.py README.rst /project-minimal-copy/ |
| 44 | +RUN cd /project-minimal-copy &&\ |
| 45 | + pip install ".[dev]" &&\ |
| 46 | + /usr/bin/yes | pip uninstall sphinx_rtd_theme |
| 47 | + |
| 48 | + |
| 49 | +# Copy in files that we need to run the project. These files |
| 50 | +# will not be mounted into the runtime from external environment |
| 51 | +# so we copy them during build. |
| 52 | +COPY webpack.common.js webpack.dev.js webpack.prod.js /project/ |
| 53 | + |
| 54 | +# Copy in the entrypoint and we're done |
| 55 | +COPY docker-entrypoint.sh /entrypoint.sh |
| 56 | +RUN chmod +x /entrypoint.sh |
| 57 | + |
| 58 | +ENTRYPOINT ["/entrypoint.sh"] |
0 commit comments