Skip to content

Commit 86f83f8

Browse files
committed
Add a docker file for building frontend assets
1 parent 0f5d979 commit 86f83f8

File tree

2 files changed

+54
-0
lines changed

2 files changed

+54
-0
lines changed

docker/frontend.dockerfile

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
FROM ubuntu:bionic
2+
3+
ENV LANG C.UTF-8
4+
5+
# install latest python and nodejs
6+
RUN apt-get update && \
7+
apt-get install -y \
8+
nodejs \
9+
npm \
10+
gettext \
11+
git \
12+
sudo \
13+
build-essential \
14+
python3 \
15+
python3-dev \
16+
python3-pip \
17+
libxml2-dev \
18+
libxslt1-dev \
19+
zlib1g-dev
20+
21+
RUN bash -c "pip3 install pip setuptools --upgrade --force-reinstall"
22+
RUN bash -c "pip3 install virtualenv"
23+
RUN bash -c "npm install -g bower"
24+
25+
# RUN adduser --system --shell /bin/bash --home "/repo" rtd
26+
27+
# A volume used to share `pex`/`whl` files and fixtures with docker host
28+
VOLUME /repo
29+
30+
# do the time-consuming base install commands
31+
CMD /bin/bash -c "/usr/local/bin/virtualenv -p python3 rtd \
32+
&& source rtd/bin/activate \
33+
&& cd /repo \
34+
&& pip install -r requirements.txt \
35+
&& npm install \
36+
&& bower --allow-root install \
37+
&& npm run vendor \
38+
&& npm run build"

docs/development/standards.rst

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,22 @@ may change, so that assets are compiled before deployment, however as our front
5353
end assets are in a state of flux, it's easier to keep absolute sources checked
5454
in.
5555

56+
Build in a Docker container
57+
---------------------------
58+
59+
Front end assets can be built in a Docker container. This simplifies the steps
60+
needed (described in the following sections) and can be considered more secure,
61+
since you won't expose your local development environment to packages from NPM.
62+
63+
.. code-block:: console
64+
65+
# Builds the Docker image
66+
docker image build . -t "rtd-frontend" -f docker/frontend.dockerfile
67+
68+
# Runs the image from the repository root
69+
docker run -v $PWD/:/repo "rtd-frontend"
70+
71+
5672
Getting Started
5773
---------------
5874

0 commit comments

Comments
 (0)