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

Add Dockerfile and Makefile #56

Merged
merged 2 commits into from
May 11, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
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