Skip to content

Commit 7d3df72

Browse files
authored
Merge pull request #521 from Hritik14/docker-docs
Add docker docs
2 parents 369897f + 72aec03 commit 7d3df72

2 files changed

Lines changed: 93 additions & 1 deletion

File tree

README.rst

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,10 +91,22 @@ First clone the source code::
9191

9292

9393
Using Docker Compose
94-
---------------------
94+
~~~~~~~~~~~~~~~~~~~~~~
9595

9696
Please find the docker documentation in `Docker Installation <docs/docker_installation.rst>`__
9797

98+
TL;DR
99+
""""""
100+
101+
.. code-block:: bash
102+
103+
git clone https://github.com/nexB/vulnerablecode.git && cd vulnerablecode
104+
make envfile
105+
docker-compose up
106+
107+
Go to http://localhost:8000/ on a web browser to access the web UI.
108+
109+
98110
Without Docker Compose
99111
~~~~~~~~~~~~~~~~~~~~~~
100112

docs/docker_installation.rst

Lines changed: 80 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,80 @@
1+
.. _docker_image:
2+
3+
Docker image
4+
============
5+
6+
Get Docker
7+
----------
8+
9+
The first step is to download and install Docker on your platform.
10+
Refer to the following Docker documentation and choose the best installation
11+
path for you: `Get Docker <https://docs.docker.com/get-docker/>`_
12+
13+
Build the Image
14+
---------------
15+
16+
VulnerableCode is distributed with ``Dockerfile`` and ``docker-compose.yml`` files
17+
required for the creation of the Docker image.
18+
19+
Clone the git `VulnerableCode repo <https://github.com/nexB/vulnerablecode>`_,
20+
create an environment file, and build the Docker image:
21+
22+
.. code-block:: bash
23+
24+
git clone https://github.com/nexB/vulnerablecode.git && cd vulnerablecode
25+
make envfile
26+
docker-compose build
27+
28+
.. note::
29+
30+
The image will need to be re-built when the VulnerableCode app source code is
31+
modified or updated via
32+
``docker-compose build --no-cache vulnerablecode``
33+
34+
Run the Image
35+
-------------
36+
37+
Run your image as a container
38+
39+
.. code-block:: bash
40+
41+
docker-compose up
42+
43+
44+
At this point, the VulnerableCode app should be running at port ``8000`` on your Docker host.
45+
Go to http://localhost:8000/ on a web browser to access the web UI.
46+
Optionally, you can set ``NGINX_PORT`` environment variable in your shell or in the `.env` file to run on a different port than 8000.
47+
48+
.. note::
49+
50+
To access a dockerized VulnerableCode app from a remote location, the ``ALLOWED_HOSTS``
51+
setting need to be provided in your ``docker.env`` file::
52+
53+
ALLOWED_HOSTS=.domain.com,127.0.0.1
54+
55+
Refer to `Django ALLOWED_HOSTS settings <https://docs.djangoproject.com/en/dev/ref/settings/#allowed-hosts>`_
56+
for documentation.
57+
58+
.. warning::
59+
60+
Serving VulnerableCode on a network could lead to security issues and there
61+
are several steps that may be needed to secure such a deployment.
62+
Currently, this is not recommendend.
63+
64+
65+
Invoke the importers
66+
--------------------
67+
68+
Connect to the Docker container ``bash``.
69+
From here you can access ``manage.py`` and run management commands
70+
to import data as specified in the `Data import <../README.rst#data-import>`_ section and run commands
71+
for the importers from there
72+
73+
For example:
74+
75+
.. code-block:: bash
76+
77+
docker-compose exec vulnerablecode bash
78+
./manage.py import --list
79+
80+

0 commit comments

Comments
 (0)