This repository has been archived by the owner on Jun 21, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 172
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #56 from jgmize/docker
Add Dockerfile and Makefile
- Loading branch information
Showing
2 changed files
with
59 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |