Skip to content

Commit

Permalink
Merge pull request #12 from oSoMoN/dockerfile-compose
Browse files Browse the repository at this point in the history
Containerize PaSe into a pair of Docker containers
  • Loading branch information
boiko committed Nov 8, 2023
2 parents ada7717 + 5edcf9b commit c739de1
Show file tree
Hide file tree
Showing 7 changed files with 15,132 additions and 11,880 deletions.
5 changes: 5 additions & 0 deletions .env
@@ -0,0 +1,5 @@
# Path to the directory containing the sources to index on the host
SRCDIR=/usr/src

# Path to the index directory on the host
INDEXDIR=/var/cache/pase
11 changes: 11 additions & 0 deletions CONTRIBUTING.md
Expand Up @@ -29,3 +29,14 @@ To just run tests, execute:
mvn test
```

## Building and running as Docker containers

To ease experimentation with PaSe, use the bundled `Dockerfile` and `compose.yaml`
to build and run a pair of Docker containers (one for the source indexer, one for the web server).

Edit the paths to the directory containing the sources (`$SRCDIR`) and to where the index will be
written (`$INDEXDIR`) on the host in file `.env`, then run `docker compose up`.

This will build and run a pair of containers named `pase-indexer-1` and `pase-server-1`.
The indexer will scan and index the directory containing the sources, then exit.
The server will listen indefinitely for requests targeting the index at http://localhost:4567/.
14 changes: 14 additions & 0 deletions Dockerfile
@@ -0,0 +1,14 @@
FROM registry.suse.com/bci/openjdk-devel:11 AS builder
WORKDIR /src
COPY . .
RUN zypper -n refresh
RUN zypper -n install npm
RUN npm install ./frontend
RUN ./build.sh

FROM registry.suse.com/bci/openjdk:11
LABEL description="Pa(tch)Se(arch) is an experimental search engine for code allowing search by patch."
LABEL version="0.1"
WORKDIR /opt/pase
COPY --from=builder /src/target/pase-*.jar pase.jar
ENTRYPOINT ["java", "-jar", "pase.jar"]
2 changes: 1 addition & 1 deletion README.md
Expand Up @@ -23,4 +23,4 @@ Once indexing has finished, you can search:
- use `java -jar pase.jar serve <index_path>` to start the PaSe Server
- visit [http://localhost:4567](http://localhost:4567) with your browser

![Screen capture of PaSe's Web UI](doc/pase-webui.gif)
![Screen capture of PaSe's Web UI](doc/pase-webui.gif)
14 changes: 14 additions & 0 deletions compose.yaml
@@ -0,0 +1,14 @@
services:
indexer:
build: .
volumes:
- ${SRCDIR}:/src
- ${INDEXDIR}:/index
command: ["index", "/src", "/index"]
server:
build: .
volumes:
- ${INDEXDIR}:/index
command: ["serve", "/index"]
ports:
- "4567:4567"

0 comments on commit c739de1

Please sign in to comment.