Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added Dockerfile #83

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
.git
docker-compose.yaml
glass_start.sh
glass_stop.sh
config_backups
16 changes: 16 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
FROM node:8
WORKDIR /home/node/app

# install isc-dhcp-server; for config checking
RUN apt update && apt install isc-dhcp-server -y && rm -rf /var/cache/apt

# cache node_modules
COPY package.json .
COPY package-lock.json .

RUN npm install

# copy the remainder of src
COPY . .

CMD node ./bin/www
17 changes: 17 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -146,6 +146,23 @@

<img src="https://user-images.githubusercontent.com/3319450/31207663-40cf573e-a945-11e7-8753-288e68a38da1.jpg" width="300">

# Docker
1) Clone down the repo and do any configuration in `glass_config.json`.
2) Run `build-docker.sh` to create the container, tagged as `glass-isc-dhcp`.
3) Run the container for example:
`docker run -d --name glass --restart unless-stopped -p 8080:8080 -p 3000:3000 -v /var/lib/dhcp:/var/lib/dhcp -v /etc/dhcp/dhcpd.conf:/etc/dhcp/dhcpd.conf -v $(pwd)/config_backups:/home/node/app/config_backups glass-isc-dhcp:latest`

> You can mount another config file if you want to store that outside the container, the app root is `/home/node/app`, so you can use `-v /path/to/glass_config.json:/home/node/app/config/glass_config.json`

To update the container do the following:
1. Pull changes via `git`
2. Run `build-docker.sh`
3. Remove the old container, for example `docker stop glass && docker rm glass`
- Be sure to backup your config! `docker exec -it glass cat /home/node/app/config/glass_config.json`
4. Recreate the container, `docker run -d --name glass --restart unless-stopped -p 8080:8080 -p 3000:3000 -v /var/lib/dhcp:/var/lib/dhcp -v /etc/dhcp/dhcpd.conf:/etc/dhcp/dhcpd.conf -v $(pwd)/config_backups:/home/node/app/config_backups glass-isc-dhcp:latest`

> If you had the config file mounted outside the container, edit the last command above accordingly.

# Installation
* Instructions are per Debian/Ubuntu Distros

Expand Down
2 changes: 2 additions & 0 deletions build-docker.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
#!/usr/bin/env bash
docker build -t glass-isc-dhcp .