Skip to content

Commit

Permalink
Add Dockerfile, and Makefile targets for it.
Browse files Browse the repository at this point in the history
  • Loading branch information
zachm committed Mar 28, 2016
1 parent 1717328 commit de16eb4
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 6 deletions.
15 changes: 15 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
FROM ubuntu:trusty
MAINTAINER Zach Musgrave <[email protected]>

RUN apt-get update
RUN apt-get install -y git make
RUN apt-get install -y python2.7 python2.7-dev python-pip
RUN apt-get install -y libyaml-dev libpcre3-dev

ADD . /
RUN pip install -Ur requirements.txt
RUN make frontend

CMD uwsgi --ini tscached.uwsgi.ini --wsgi-file tscached/uwsgi.py

EXPOSE 8008
19 changes: 13 additions & 6 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,12 @@
# Feel free to change PYTHONEXEC if you need to.

PYTHONEXEC=python2.7
DEBUGPORT=8008
PORT=8008


# turns out 'source' isn't a thing in sh.
SHELL=/usr/bin/env bash
PACKAGE_VERSION=$(shell python setup.py --version 2>/dev/null)
PACKAGE_DEBIAN_REVISION=1
VERSION_BASH=$(shell bash -c "cat tscached/__init__.py | grep VERSION | sed 's/VERSION = //g' | sed \"s/'//g\"")
VERSION_PYTHON=$(shell python setup.py --version 2>/dev/null)

# builds the darn thing
all: venv frontend
Expand Down Expand Up @@ -43,7 +42,7 @@ run: venv frontend

# Run with single-threaded debug server. Flask gives you auto-reloading on code changes for free.
debug: venv frontend
echo "from tscached import app; app.debug = True; app.run(host='0.0.0.0', port=${DEBUGPORT})" > debug-run.py
echo "from tscached import app; app.debug = True; app.run(host='0.0.0.0', port=${PORT})" > debug-run.py
source venv/bin/activate; venv/bin/python debug-run.py

# Copy the debug frontend from kairosdb into our project
Expand All @@ -60,4 +59,12 @@ package: frontend

# changelog stuff
changelog:
dch -D trusty -u low -v ${PACKAGE_VERSION}-1
dch -D trusty -u low -v ${VERSION_PYTHON}-1

.PHONY: docker_build
docker_build:
docker build -t tscached_v${VERSION_BASH} .

.PHONY: docker_run
docker_run: docker_build
docker run -p 0.0.0.0:${PORT}:8008 -t tscached_v${VERSION_BASH}

0 comments on commit de16eb4

Please sign in to comment.