From 1d1442c9e1f0cd7aaf3693cb6c7662d671fe23a8 Mon Sep 17 00:00:00 2001 From: Michael Allen Date: Mon, 7 Aug 2017 16:21:16 +0100 Subject: [PATCH] Set up a basic docker development container --- Dockerfile | 15 +++++++++++++++ Makefile | 20 ++++++++++++++++++++ docker-compose.yml | 11 +++++++++++ package.json | 22 ++++++++++++++++++++++ 4 files changed, 68 insertions(+) create mode 100644 Dockerfile create mode 100644 Makefile create mode 100644 docker-compose.yml create mode 100644 package.json diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..a90a4f3 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,15 @@ +FROM node + +ARG NODE_ENV=development +ENV NODE_ENV $NODE_ENV + +WORKDIR /usr/src +COPY package.json /usr/src +RUN yarn install && yarn cache clean --force +ENV PATH /usr/src/node_modules/.bin:$PATH +ENV NPM_CONFIG_PREFIX /usr/src/node_modules + +WORKDIR /usr/src/app +COPY . /usr/src/app + +CMD ["yarn", "test"] diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..350ec92 --- /dev/null +++ b/Makefile @@ -0,0 +1,20 @@ +.PHONY: build test + +define compose + docker-compose $(1) +endef + +define yarn + $(call compose, run dev yarn $1) +endef + +all: build bash + +build: + $(call compose, build --pull) + +bash: + $(call compose, run --service-ports dev bash) + +test: + $(call yarn, $@) diff --git a/docker-compose.yml b/docker-compose.yml new file mode 100644 index 0000000..2efefd4 --- /dev/null +++ b/docker-compose.yml @@ -0,0 +1,11 @@ +version: '2.1' + +services: + dev: + build: + context: . + volumes: + - .:/usr/src/app + ports: + - "9229:9229" + - "3000:3000" diff --git a/package.json b/package.json new file mode 100644 index 0000000..102885f --- /dev/null +++ b/package.json @@ -0,0 +1,22 @@ +{ + "name": "@hmcts/look-and-feel", + "description": "One question per page apps made easy", + "version": "0.0.1", + "license": "MIT", + "engines": { + "node": ">=6.0" + }, + "main": "./src/main.js", + "scripts": { + "test": "NODE_PATH=. NODE_ENV=testing mocha 'test/**/*.test.js'" + }, + "dependencies": { + "express": "^4.15.3", + "express-nunjucks": "^2.2.3", + "govuk_template_jinja": "^0.22.3", + "nunjucks": "^3.0.1" + }, + "devDependencies": { + "eslint": "^4.4.0" + } +}