Skip to content
This repository has been archived by the owner on Jan 9, 2023. It is now read-only.

Commit

Permalink
Merge pull request #623 from N7down/dockerfile
Browse files Browse the repository at this point in the history
added dockerfile
  • Loading branch information
jkleinsc authored Aug 31, 2016
2 parents e3c0150 + 31dfa0f commit 8966639
Show file tree
Hide file tree
Showing 3 changed files with 48 additions and 3 deletions.
23 changes: 23 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
FROM ubuntu:14.04

# install couchdb
RUN apt-get update && apt-get install curl sudo git wget -y

# install hospital run
RUN curl -sL https://deb.nodesource.com/setup_4.x | sudo -E bash -
RUN apt-get update && apt-get install nodejs -y
RUN mkdir -p /usr/src/app
WORKDIR /usr/src/app
COPY . /usr/src/app
RUN npm install -g npm && npm install -g ember-cli@latest && npm install -g bower
RUN npm install
RUN bower install --allow-root
COPY ./server/config-example.js ./server/config.js

RUN sed -i -e 's/URL="localhost"/URL="couchdb"/g' ./script/initcouch.sh
RUN sed -i -e "s/couchDbServer: 'localhost'/couchDbServer: 'couchdb'/g" ./server/config.js
RUN sed -i -e "s/localhost:5984/couchdb:5984/g" ./script/server

EXPOSE 4200

ENTRYPOINT ./script/initcouch.sh && npm start
18 changes: 18 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,24 @@ To start the frontend please do the following:
- Start the server by running `npm start` in the repo folder.
- Go to [http://localhost:4200/](http://localhost:4200/) in a browser and login with username `hradmin` and password `test`.

## Running with Docker
To run HospitalRun with Docker please do the following:
- Goto [https://docs.docker.com/engine/installation](https://docs.docker.com/engine/installation) to download and install Docker.
- Clone the repository with the command `git clone https://github.com/HospitalRun/hospitalrun-frontend.git`.
- Change to the hospitalrun-frontend directory `cd hosptialrun-frontend`.
- Build the HosptialRun image with `docker build -t hospitalrun-frontend .`
- Execute `docker run -it --name couchdb -d couchdb` to create the couchdb container.
- Execute `docker run -it --name hospitalrun-frontend -p 4200:4200 --link couchdb:couchdb -d hospitalrun-frontend` to create the HospitalRun container.

### Accessing HospitalRun with Docker Toolbox
If you are running with Docker Toolbox you will have to run the following commands to get the IP of the docker machine where hospitalrun-frontend is running with the following:
- Run the following command to get the ip of the docker machine that the image was created on `docker-machine ip default`.
- Go to `http://<docker-machine ip>:4200` in a browser and login with username `hradmin` and password `test`.

### Accessing HospitalRun with Docker
If you are not running with docker toolbox please do the following:
- Go to `http://localhost:4200` in a browser and login with username `hradmin` and password `test`.

### Troubleshooting your local environment
Always make sure to `git pull` and get the latest from master.

Expand Down
10 changes: 7 additions & 3 deletions script/initcouch.sh
Original file line number Diff line number Diff line change
@@ -1,10 +1,14 @@
#!/bin/bash

URL="localhost"
PORT="5984"

if [ -z "${1}" ] || [ -z "${2}" ]; then
HOST="http://127.0.0.1:5984"
HOST="http://$URL:$PORT"
curl -X PUT $HOST/_config/admins/couchadmin -d '"test"'
SECUREHOST="http://couchadmin:test@127.0.0.1:5984"
SECUREHOST="http://couchadmin:test@$URL:$PORT"
else
SECUREHOST="http://$1:$2@127.0.0.1:5984"
SECUREHOST="http://$1:$2@$URL:$PORT"
fi
curl -X PUT $SECUREHOST/_users/_security -d '{ "admins": { "names": [], "roles": ["admin"]}, "members": { "names": [], "roles": []}}'
curl -X PUT $SECUREHOST/config
Expand Down

0 comments on commit 8966639

Please sign in to comment.