Skip to content
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
20 changes: 20 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# adapted from https://github.com/orchardup/docker-nginx

from ubuntu

run apt-get update && apt-get -y install nginx
run echo "daemon off;" >> /etc/nginx/nginx.conf
run mkdir /etc/nginx/ssl

add default /etc/nginx/sites-available/default
add default-ssl /etc/nginx/sites-available/default-ssl
add src/ /var/www

# uncomment and add crt and key for ssl
#add server.crt /etc/nginx/ssl/
#add server.key /etc/nginx/ssl/
#run ln -s /etc/nginx/sites-available/default-ssl /etc/nginx/sites-enabled/default-ssl

expose 80

cmd [ "nginx" ]
32 changes: 32 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
# this uses sudo -E bash so it can be used on both OSX and Linux

summer := $(which md5 || which md5sum)

all: build run

build:
@echo "Building container..."
@sudo -E bash -c "docker build --rm -t encryptr-web ."

run: kill
@echo "Running..."
@sudo -E bash -c "docker run -p 80:80 -d --name encryptr-static encryptr-web"

kill:
@echo "Killing any running encryptr-web container..."
@sudo -E bash -c "docker kill encryptr-static" || true
@echo "Removing any running encryptr-web container..."
@sudo -E bash -c "docker rm encryptr-static" || true

watch:
@echo "Watching src/ directory..."
@summer=`which md5 || which md5sum`; \
sum1=""; \
while [[ true ]]; do \
sum2="`find src/ -type f -exec md5 {} \; | $$summer;`"; \
if [[ "$$sum1" != "$$sum2" ]]; then make && sum1=$$sum2; fi; \
sleep 1; \
done


PHONY: all build run kill watch
52 changes: 52 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
# Encryptr website

## Dependencies

On all platforms, `docker` is required.

On OSX, `boot2docker` is a necessary dependency of `docker`.

This assumes the latest version of both.

## Usage

To build the Docker container:

````
make build
````

To run the container and serve the website:

````
make serve
````

For both:

````
make
````

For both upon filechange in /src:

````
make watch
````

If you need to kill the serving container (automatically run on other commands):

````
make kill
````

In the interest of multi-platform ability,
the use of `sudo` is required in the Makefile,
so you will have to type in an administrator password.

If you are on OS X, you will need to run `boot2docker ip`
in order to see where it is served from.

It is currently configured to serve on port 80,
but there are instructions to enable SSL in the Dockerfile.

13 changes: 13 additions & 0 deletions default
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
server {
root /var/www;
index index.html index.htm;

# Make site accessible from http://localhost/
server_name localhost;

location / {
# First attempt to serve request as file, then
# as directory, then fall back to index.html
try_files $uri $uri/ /index.html;
}
}
10 changes: 10 additions & 0 deletions default-ssl
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
server {
listen 443;

root /var/www;
index index.html index.htm;

ssl on;
ssl_certificate /etc/nginx/ssl/server.crt;
ssl_certificate_key /etc/nginx/ssl/server.key;
}
File renamed without changes.
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes.
File renamed without changes.
File renamed without changes.