Docker related scripts and config files are under CodeCompass/docker. After navigating to this directory you can use the build scripts with the commands below.
...
`-CodeCompass
|-CodeCompass # Source code from Git.
| `-docker # Docker related files.
| `-dev # Docker files for development.
|-build # CMake runs here.
|-install # CodeCompass goes here.
`-workspace # Parsed projects' workspace directory.
The scripts assume this layout. The build and install directories will be
generated to the parent directory of CodeCompass directory containing the
source code. The workspace directory should be created manually.
Build the development environment image. The tag name is important!
docker build -t codecompass-dev docker/dev
You can use the codecompass-dev image created above to develop CodeCompass.
First, you have to start a docker container from this image, which will mount
your CodeCompass directory from your host and starts a shell:
docker run --rm -ti \
--env DATABASE=sqlite --env BUILD_TYPE=Release \
--volume /path/to/host/CodeCompass:/CodeCompass \
--volume /path/to/your/host/project:/projects/myproject \
--publish 8001:8080 \
codecompass-dev \
/bin/bashThis container will be used in the next subsections to build CodeCompass, parse a project and start a webserver.
Note: you do not have to give the --publish option and set the DATABASE
environment variable if you do not want to run a webserver. Also you do not
have to mount a project directory if you do not want to parse it later.
You can use the codecompass-build.sh script inside the container to build,
install and test CodeCompass:
# Build CodeCompass.
codecompass-build.sh -j8
# Install CodeCompass.
codecompass-build.sh install
# Run tests.
codecompass-build.sh testYou can parse a project inside a docker container by using the following command:
CodeCompass_parser \
-d "sqlite:database=/CodeCompass/workspace/myproject/data.sqlite" \
-w /CodeCompass/workspace \
-n myproject \
-i /projects/myprojectNote: the project directory should be mounted inside the container.
You can start a webserver inside the container by using the following command:
# Create a workspace directory.
mkdir -p /CodeCompass/workspace
# Run the web server.
CodeCompass_webserver \
-w /CodeCompass/workspace