Skip to content

Commit

Permalink
build(docker): add initial docker configuration
Browse files Browse the repository at this point in the history
build(docker): update naming and add Makefile
  • Loading branch information
jaebradley authored and georgebabey committed May 10, 2018
1 parent b3e9727 commit c660582
Show file tree
Hide file tree
Showing 6 changed files with 2,399 additions and 3,490 deletions.
10 changes: 10 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
node_modules
npm-debug.log
README.md
LICENSE
.babelrc
.eslintignore
.eslintrc.json
.gitignore
.npmignore
commitlint.config.js
29 changes: 29 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
# Copied from https://github.com/BretFisher/node-docker-good-defaults/blob/master/Dockerfile

FROM node:8.9.4

# Create app directory
RUN mkdir -p /edx/app

ARG NODE_ENV=production
ENV NODE_ENV $NODE_ENV

ARG PORT=80
ENV PORT $PORT
EXPOSE $PORT 1991

WORKDIR /edx
# Install app dependencies
# A wildcard is used to ensure both package.json AND package-lock.json are copied
# where available (npm@5+)
COPY package*.json ./

# If you are building your code for production
# RUN npm install --only=production
RUN npm install
ENV PATH /edx/app/node_modules/.bin:$PATH

WORKDIR /edx/app
COPY . /edx/app

CMD [ "npm", "run", "start" ]
29 changes: 29 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
shell: ## run a shell on the cookie-cutter container
docker exec -it /bin/bash

build:
docker-compose build

up: ## bring up cookie-cutter container
docker-compose up

up-detached: ## bring up cookie-cutter container in detached mode
docker-compose up -d

logs: ## show logs for cookie-cutter container
docker-compose logs -f

down: ## stop and remove cookie-cutter container
docker-compose down

npm-install-%: ## install specified % npm package on the cookie-cutter container
docker exec npm install $* --save-dev
git add package.json

restart:
make down
make up

restart-detached:
make down
make up-detached
18 changes: 18 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@

version: "2"
services:
web:
build:
context: .
args:
- NODE_ENV=development
volumes:
- .:/edx/app:delegated
- notused:/edx/app/node_modules
ports:
- "1991:1991"
environment:
- NODE_ENV=development

volumes:
notused:
Loading

0 comments on commit c660582

Please sign in to comment.