Skip to content

Commit 0744b6e

Browse files
ibnesayeedCh4s3
authored andcommitted
Dockerfile and documentation (#104)
* Disabled Redis disc persistence and refactored integration test, fixes #95 * Added Dockerfile with documentation
1 parent 6ea1243 commit 0744b6e

File tree

2 files changed

+70
-0
lines changed

2 files changed

+70
-0
lines changed

Dockerfile

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
FROM ruby:2.3
2+
MAINTAINER Sawood Alam <https://github.com/ibnesayeed>
3+
4+
ENV LANG C.UTF-8
5+
6+
RUN apt update && apt install -y libgsl0-dev && rm -rf /var/lib/apt/lists/*
7+
8+
RUN cd /tmp \
9+
&& wget http://download.redis.io/redis-stable.tar.gz \
10+
&& tar xvzf redis-stable.tar.gz \
11+
&& cd redis-stable \
12+
&& make && make install \
13+
&& cd /tmp && rm -rf redis-stable*
14+
15+
WORKDIR /usr/src/app
16+
COPY . /usr/src/app
17+
RUN bundle install
18+
RUN gem install narray nmatrix gsl redis
19+
20+
CMD redis-server --daemonize yes && rake

README.markdown

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -252,6 +252,56 @@ with more than just simple strings.
252252
* http://www.chadfowler.com/index.cgi/Computing/LatentSemanticIndexing.rdoc
253253
* http://en.wikipedia.org/wiki/Latent_semantic_analysis
254254

255+
## Development
256+
257+
To make changes in the gem locally:
258+
259+
```bash
260+
$ git clone [email protected]:jekyll/classifier-reborn.git
261+
# Alternatively, fork the repo and clone your fork.
262+
$ cd classifier-reborn
263+
$ bundle install
264+
$ gem install redis
265+
$ rake # To run tests.
266+
```
267+
268+
Some tests should be skipped if the Redis server is not running on the development machine. To test all the test cases first [install Redis](https://redis.io/topics/quickstart) then:
269+
270+
```bash
271+
$ redis-server --daemonize yes
272+
$ rake # To run tests.
273+
$ rake bench # To run benchmarks.
274+
# Kill the redis-server daemon when done
275+
```
276+
277+
### Development using Docker
278+
279+
If the [Docker](https://docs.docker.com/engine/installation/) is installed on the machine:
280+
281+
```bash
282+
$ git clone [email protected]:jekyll/classifier-reborn.git
283+
# Alternatively, fork the repo and clone your fork.
284+
$ cd classifier-reborn
285+
286+
$ docker run --rm -it -v "$PWD":/usr/src/app jekyll/classifier-reborn
287+
# This will run all tests.
288+
# This step should repeated each time a change in the code is made.
289+
```
290+
291+
If the Gemfile or other dependencies change, a rebuild of the Docker image is needed:
292+
293+
```bash
294+
$ docker build -t jekyll/classifier-reborn .
295+
```
296+
297+
To run tasks other than test or other commands access Bash prompt of the container:
298+
299+
```bash
300+
$ docker run --rm -it -v "$PWD":/usr/src/app classifier-reborn bash
301+
root@[container-id]:/usr/src/app# redis-server --daemonize yes
302+
root@[container-id]:/usr/src/app# rake # To run tests.
303+
root@[container-id]:/usr/src/app# rake bench # To run benchmarks.
304+
```
255305

256306
## Code of Conduct
257307

0 commit comments

Comments
 (0)