-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Docker configuration for dev environment
- Loading branch information
1 parent
a08e3d6
commit 1997725
Showing
5 changed files
with
119 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
# python:3-alpine contains node 18 so has to go first | ||
# in order to get overwritten | ||
FROM python:3-alpine | ||
FROM node:14-alpine | ||
|
||
# Do not use --update since that will also fetch the | ||
# latest node-current package | ||
# 'make' is needed for building documentation | ||
RUN apk add npm make py3-pip py3-wheel | ||
|
||
# Add an extra verification that we have the right node | ||
# because the above caused issues | ||
RUN node -v && node -v | grep -q v14 | ||
|
||
RUN pip install pip --upgrade | ||
|
||
RUN mkdir -p /project/src/ &&\ | ||
mkdir -p /project/docs/ &&\ | ||
mkdir -p /project-static-copy | ||
|
||
WORKDIR /project | ||
|
||
COPY package.json /project/ | ||
|
||
# COPY package-lock.json /project/ | ||
|
||
COPY bin/preinstall.js /project/bin/preinstall.js | ||
|
||
RUN cd /project | ||
|
||
# It matters that the node environment is installed into the same | ||
# folder, i.e. /project where we will run the environment from | ||
RUN npm install --package-lock-only &&\ | ||
npm audit fix &&\ | ||
npm install | ||
|
||
# This is strictly speaking not necessary, just makes | ||
# running the container faster... | ||
# Install dependencies, then uninstall project itself | ||
COPY . /project-static-copy | ||
RUN cd /project-static-copy &&\ | ||
pip install ".[dev]" &&\ | ||
/usr/bin/yes | pip uninstall sphinx_rtd_theme | ||
|
||
|
||
# Copy in stuff we need to run the project | ||
COPY webpack.common.js webpack.dev.js webpack.prod.js /project/ | ||
|
||
COPY docker-entrypoint.sh /entrypoint.sh | ||
RUN chmod +x /entrypoint.sh | ||
|
||
ENTRYPOINT ["/entrypoint.sh"] |
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,19 @@ | ||
SHELL := /bin/bash | ||
CWD := $(shell cd -P -- '$(shell dirname -- "$0")' && pwd -P) | ||
|
||
docker-images: | ||
docker build -t sphinx_rtd_theme:latest . | ||
|
||
docker-run: | ||
rm -f .container_id | ||
docker run --cidfile=.container_id -t -i -p 1919:1919 \ | ||
--network host \ | ||
--mount type=bind,source="$(CWD)",target=/project-readonly,readonly \ | ||
--mount type=volume,dst=/project-readonly/sphinx_rtd_theme.egg-info,volume-driver=local \ | ||
--mount type=bind,source="$(CWD)/src",target=/project/src,readonly \ | ||
--mount type=bind,source="$(CWD)/docs",target=/project/docs \ | ||
sphinx_rtd_theme:latest $(command) | ||
|
||
docker-copy-assets: | ||
docker cp "$(shell cat .container_id):/project/sphinx_rtd_theme" . | ||
docker cp "$(shell cat .container_id):/project/package-lock.json" . |
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,11 @@ | ||
#!/bin/sh | ||
|
||
# Install the readonly project in editable mode and make sure | ||
# all dependencies are upgrade. This is mounted in from the | ||
# outside, but it is on purpose that it is readonly! | ||
cd /project-readonly | ||
pip install --upgrade -e ".[dev]" | ||
|
||
cd /project | ||
|
||
npm run $@ |
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