Skip to content
This repository has been archived by the owner on Jun 21, 2022. It is now read-only.

Commit

Permalink
Merge pull request #56 from jgmize/docker
Browse files Browse the repository at this point in the history
Add Dockerfile and Makefile
  • Loading branch information
jgmize committed May 11, 2016
2 parents c969fac + c146eae commit 0253be4
Show file tree
Hide file tree
Showing 2 changed files with 59 additions and 0 deletions.
15 changes: 15 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
FROM debian:jessie

ENV PYTHONDONTWRITEBYTECODE=1

# need python and build-essential for node-gyp
RUN apt-get update && \
apt-get install -y --no-install-recommends python2.7 build-essential nodejs npm
RUN update-alternatives --install /usr/bin/node node /usr/bin/nodejs 10

ENV NODE_PATH=/node_modules
COPY package.json /
RUN npm install

WORKDIR /app
COPY . /app
44 changes: 44 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
VERSION ?= $(shell git describe --tags --exact-match 2>/dev/null || git rev-parse --short HEAD)
REGISTRY ?= quay.io/
IMAGE_PREFIX ?= mozmar
IMAGE_NAME ?= kumascript
IMAGE ?= ${REGISTRY}${IMAGE_PREFIX}/${IMAGE_NAME}\:${VERSION}
MOUNT_DIR ?= $(shell pwd)
APP_DIR ?= /app
PORT ?= 9080
DOCKER_RUN_ARGS ?= -v ${MOUNT_DIR}\:${APP_DIR} -w ${APP_DIR}
DOCKER_PORT_ARGS ?= -p "${PORT}:${PORT}"
DEIS_PROFILE ?= usw
DEIS_APP ?= kumascript-dev
PRIVATE_IMAGE ?= ${PRIVATE_REGISTRY}/${DEIS_APP}\:${VERSION}


build:
docker build -t ${IMAGE} .

push:
docker push ${IMAGE}

run:
docker run ${DOCKER_RUN_ARGS} ${DOCKER_PORT_ARGS} ${IMAGE} node run.js

test:
docker run ${DOCKER_RUN_ARGS} ${IMAGE} ./node_modules/.bin/nodeunit tests

bash:
docker run -it ${DOCKER_RUN_ARGS} ${IMAGE} bash

deis-pull:
deis pull ${IMAGE} -a ${DEIS_APP}

push-private-registry:
docker tag ${IMAGE} ${PRIVATE_IMAGE}
docker push ${PRIVATE_IMAGE}

deis-pull-private:
deis pull ${DEIS_APP}:${VERSION} -a ${DEIS_APP}

build-deploy: build push deis-pull
build-private-deploy: build push-private-registry deis-pull-private

.PHONY: build push run test bash deis-pull push-private-registry deis-pull-private build-deploy build-private-deploy

0 comments on commit 0253be4

Please sign in to comment.