Skip to content

Commit

Permalink
Dockerfile for development environment
Browse files Browse the repository at this point in the history
  • Loading branch information
elsbrock committed Jan 24, 2015
1 parent bb32d32 commit 98ac51e
Show file tree
Hide file tree
Showing 6 changed files with 69 additions and 5 deletions.
2 changes: 1 addition & 1 deletion Gruntfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ module.exports = function (grunt) {
port: 8000,
livereload: 35729,
// Change this to '0.0.0.0' to access the server from outside
hostname: 'localhost'
hostname: '0.0.0.0'
},
proxies: [
{
Expand Down
16 changes: 12 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,22 +31,30 @@ In case of questions, please talk to Else.

## Setup

### Requirements
### Docker

cd docker && docker build -t rzl-homepage .
docker run --privileged=true -p 127.0.0.1:8000:8000 -v $(pwd):/home/dev rzl-homepage

### Plain

#### Requirements

sudo apt-get install nodejs npm jekyll
sudo npm install -g grunt-cli bower

### Dependencies
#### Dependencies

npm install
export PATH=$PATH:$(npm bin)
bower install

### Hacking
#### Hacking

grunt serve
vi app/$file

### Building
#### Building

grunt

Expand Down
27 changes: 27 additions & 0 deletions docker/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
FROM phusion/baseimage:0.9.16
MAINTAINER Simon Elsbrock <simon@iodev.org>

ENV LANG en_US.UTF-8

RUN /etc/my_init.d/00_regen_ssh_host_keys.sh
CMD ["/sbin/my_init"]

RUN echo 'Acquire::http::Proxy "http://10.42.23.55:3142";' > /etc/apt/apt.conf.d/90-apt-cacher.conf

RUN \
echo "APT::Install-Recommends \"true\";\nAPT::Install-Suggests \"false\";" > /etc/apt/apt.conf ;\
echo "Europe/Berlin" > /etc/timezone && DEBIAN_FRONTEND=noninteractive dpkg-reconfigure tzdata ;\
locale-gen en_US.UTF-8 en_DK.UTF-8 de_DE.UTF-8 ;\
apt-get -q -y update ;\
apt-get install -y git nodejs npm ruby ruby-dev make gcc ;\
apt-get clean && rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* ;\
update-alternatives --install /usr/bin/node node /usr/bin/nodejs 10 ;\
gem install jekyll --no-rdoc --no-ri ;\
mkdir -p /etc/my_init.d

RUN \
adduser --disabled-password --gecos "" dev

ADD install-deps.sh /etc/my_init.d/install-deps.sh

EXPOSE 8000
10 changes: 10 additions & 0 deletions docker/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
This docker container aims to minimize the efforts to get a development
environment running. The idea is that you simply run this container and start
hacking. The container mounts the repository root as volume and does not store
any data within itself.

The container comes preinstalled with all static dependencies. In addition, it
takes care of the following:
* installing npm dependencies
* installing bower dependencies
* running `grunt serve`
14 changes: 14 additions & 0 deletions docker/install-deps.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
#!/bin/bash

cd /home/dev

grep -sq 'github.com/raumzeitlabor/rzl-homepage' .git/config || { \
echo -e "\nDid you mount the rzl-homepage repository root?\n"; exit 1; \
}

sudo -u dev -s -- <<EOF
npm install
export PATH=./node_modules/.bin:$PATH
bower install
grunt serve
EOF
5 changes: 5 additions & 0 deletions docker/run-guard.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
#!/bin/bash

sudo -u app npm install
sudo -u app PATH=./node_modules/.bin:$PATH bower install
sudo -u app grunt serve

0 comments on commit 98ac51e

Please sign in to comment.