Skip to content

Commit 7c635c2

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

File tree

2 files changed

+59
-2
lines changed

2 files changed

+59
-2
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: 21 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,8 +53,27 @@ 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-
Getting Started
57-
---------------
56+
Containerized build (Docker)
57+
----------------------------
58+
59+
Front end assets can be built in a Docker container. This reduces the steps
60+
required and can be considered more secure, since you won't expose your local
61+
development environment to packages from NPM.
62+
63+
You will need to install Docker on your system, then run the following commands
64+
from the root of your repository:
65+
66+
.. code-block:: console
67+
68+
# Builds the Docker image
69+
docker image build . -t "rtd-frontend" -f docker/frontend.dockerfile
70+
71+
# Runs the image from the repository root
72+
docker run -v $PWD/:/repo "rtd-frontend"
73+
74+
75+
Local build: Getting Started
76+
----------------------------
5877

5978
You will need a working version of Node and NPM to get started. We won't cover
6079
that here, as it varies from platform to platform.

0 commit comments

Comments
 (0)