Skip to content

Commit

Permalink
add Dockerfile
Browse files Browse the repository at this point in the history
  • Loading branch information
cmil committed May 2, 2020
1 parent faa4fa9 commit b7edccd
Show file tree
Hide file tree
Showing 3 changed files with 48 additions and 0 deletions.
2 changes: 2 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
.git*
node_modules
22 changes: 22 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
FROM node:12
LABEL maintainer="[email protected]"

ENV dbhost 0.0.0.0
ENV dbport 1984
ENV dbname histvv

WORKDIR /usr/src/histvv
COPY . .
RUN npm install

# add wait-for-it.sh so it can be used with docker-compose
RUN wget https://raw.githubusercontent.com/vishnubob/wait-for-it/master/wait-for-it.sh \
-O /usr/local/bin/wait-for-it.sh \
&& chmod +x /usr/local/bin/wait-for-it.sh

EXPOSE 3000/tcp

# override node:12 ENTRYPOINT
ENTRYPOINT []

CMD /usr/src/histvv/bin/www --db $dbname --dbhost $dbhost --dbport $dbport
24 changes: 24 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,30 @@ histvv-server --static ./histvv-data/public --xsl ./histvv-data/custom.xsl
Now the server can be accessed under http://localhost:3000/. It can be stopped
with the `Ctrl-C` key combination.

## Docker

The `Dockerfile` in this repo allows to build and run a docker container like this:

```bash
docker build -t histvv/server .
docker run -ti -p 3000:3000 -e dbhost=10.1.2.3 histvv/server
```

This would run a containerized histvv-server connecting to a BaseX database hosted at `10.1.2.3` (with the default port `1984` and database name `histvv`).
It would be available at http://localhost:3000/.

The exposed port of the histvv-server and the database it connects to can be
overridden from the command line:

```bash
docker run -ti \
-p 3003:3000 \
-e dbhost=10.1.2.3 \
-e dbport=1999 \
-e dbname=histvv_leipzig \
histvv/server
```

## Development

With `npm start` you can run an instance of the histvv server that reloads
Expand Down

0 comments on commit b7edccd

Please sign in to comment.