Skip to content

Commit 2d38c23

Browse files
committed
chore: Add dockerfile with optional PouchDB mode and docker-compose example
1 parent 41cb5d3 commit 2d38c23

8 files changed

+100
-0
lines changed

.dockerignore

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
node_modules
2+
.circleci
3+
.prettierrc
4+
.eslintignore
5+
.git
6+
couchdb-data

.gitignore

+3
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
11
node_modules
22
package-lock.json
33
config/*.json
4+
couchdb-data
5+
.idea
6+
yarn.lock

Dockerfile

+24
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
# docker build -t ohif/dicomweb-server:latest .
2+
# docker run -p 5985:5985 ohif/dicomweb-server:latest
3+
# If you want to use PouchDB in this container, add -p 5984:5984
4+
# docker run -p 5985:5985 -p 5984:5984 -e USE_POUCHDB=true -e DB_SERVER=http://0.0.0.0 ohif/dicomweb-server:latest
5+
FROM node:13.10.1-slim
6+
7+
# Install prerequisites
8+
RUN apt-get update
9+
RUN apt-get -y install supervisor
10+
11+
USER node
12+
RUN mkdir -p /home/node/app
13+
RUN mkdir -p /home/node/log/supervisor
14+
WORKDIR /home/node/app
15+
ADD . /home/node/app
16+
17+
# Restore deps
18+
RUN npm ci
19+
RUN npm install [email protected]
20+
21+
ENV USE_POUCHDB=false
22+
23+
EXPOSE 5984 5985
24+
CMD ["supervisord", "-n", "-c", "/home/node/app/dockersupport/supervisord.conf"]

docker-compose.yml

+38
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
# docker-compose up
2+
# curl -X PUT http://127.0.0.1:5984/_users
3+
# curl -X PUT http://127.0.0.1:5984/_replicator
4+
# curl -X PUT http://127.0.0.1:5984/_global_changes
5+
# curl -X PUT http://127.0.0.1:5984/chronicle
6+
# http://localhost:5984/_utils/
7+
version: '3.8'
8+
9+
services:
10+
dicomweb:
11+
build:
12+
context: .
13+
dockerfile: Dockerfile
14+
image: ohif/dicomweb-server:latest
15+
hostname: dicomweb-server
16+
environment:
17+
- PORT=5984
18+
- DB_SERVER=http://couchdb
19+
ports:
20+
- '5985:5985'
21+
depends_on:
22+
- couchdb
23+
restart: unless-stopped
24+
25+
##
26+
# LINK: https://hub.docker.com/_/couchdb
27+
##
28+
couchdb:
29+
image: couchdb:2.3.1
30+
hostname: couchdb
31+
volumes:
32+
- ./couchdb-data:/opt/couchdb/data
33+
environment:
34+
- COUCHDB_USER=admin
35+
- COUCHDB_PASSWORD=password
36+
ports:
37+
- '5984:5984'
38+
restart: unless-stopped
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
#!/bin/bash
2+
3+
if [ $USE_POUCHDB = "true" ]
4+
then
5+
echo "USE_POUCHDB is true, starting PouchDB service"
6+
/home/node/app/node_modules/pouchdb-server/bin/pouchdb-server --in-memory --host 0.0.0.0
7+
else
8+
exit 0
9+
fi
+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
#!/bin/bash
2+
cd /home/node/app
3+
npm start

dockersupport/supervisord.conf

+16
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
[supervisord]
2+
user=node
3+
logfile=/home/node/log/supervisor/supervisord.log
4+
nodaemon=true
5+
6+
[program:pouchdb]
7+
command=bash /home/node/app/dockersupport/conditionally-start-pouchdb.sh
8+
stdout_logfile=/home/node/log/supervisor/%(program_name)s.log
9+
stderr_logfile=/home/node/log/supervisor/%(program_name)s.log
10+
autorestart=true
11+
12+
[program:dicomweb-server]
13+
command=bash /home/node/app/dockersupport/dicomweb-server-service.sh
14+
stdout_logfile=/home/node/log/supervisor/%(program_name)s.log
15+
stderr_logfile=/home/node/log/supervisor/%(program_name)s.log
16+
autorestart=true

package.json

+1
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
"name": "dicomweb-server",
33
"version": "0.0.0-development",
44
"description": "Lightweight DICOMweb Server with CouchDB",
5+
"repository": "https://github.com/dcmjs-org/dicomweb-server",
56
"main": "server.js",
67
"dependencies": {
78
"atob": "^2.1.2",

0 commit comments

Comments
 (0)