Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Docker components #15

Merged
merged 4 commits into from
Apr 27, 2018
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.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
138 changes: 138 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,138 @@
# Logs
logs
*.log
npm-debug.log*
yarn-debug.log*
yarn-error.log*

# Runtime data
pids
*.pid
*.seed
*.pid.lock

# Directory for instrumented libs generated by jscoverage/JSCover
lib-cov

# Coverage directory used by tools like istanbul
coverage

# nyc test coverage
.nyc_output

# Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files)
.grunt

# Bower dependency directory (https://bower.io/)
bower_components

# node-waf configuration
.lock-wscript

# Compiled binary addons (http://nodejs.org/api/addons.html)
build/Release

# Dependency directories
node_modules/
jspm_packages/

# Typescript v1 declaration files
typings/

# Optional npm cache directory
.npm

# Optional eslint cache
.eslintcache

# Optional REPL history
.node_repl_history

# Output of 'npm pack'
*.tgz

# Yarn Integrity file
.yarn-integrity

# dotenv environment variables file
.env

# Local .terraform directories
**/.terraform/*

# .tfstate files
*.tfstate
*.tfstate.*

# .tfvars files
*.tfvars
# Logs
logs
*.log
npm-debug.log*
yarn-debug.log*
yarn-error.log*

# Runtime data
pids
*.pid
*.seed
*.pid.lock

# Directory for instrumented libs generated by jscoverage/JSCover
lib-cov

# Coverage directory used by tools like istanbul
coverage

# nyc test coverage
.nyc_output

# Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files)
.grunt

# Bower dependency directory (https://bower.io/)
bower_components

# node-waf configuration
.lock-wscript

# Compiled binary addons (https://nodejs.org/api/addons.html)
build/Release

# Dependency directories
node_modules/
jspm_packages/

# TypeScript v1 declaration files
typings/

# Optional npm cache directory
.npm

# Optional eslint cache
.eslintcache

# Optional REPL history
.node_repl_history

# Output of 'npm pack'
*.tgz

# Yarn Integrity file
.yarn-integrity

# dotenv environment variables file
.env

# next.js build output
.next

.git/
.gitignore
.travis.yml
LICENSE
Procfile
docker-compose.yml
terraform/
yarn.lock
8 changes: 8 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
FROM node:alpine
ARG NODE_ENV=production
WORKDIR /srv
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As intended, is it srv as in server or a meant to be src

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Verbal approval from @brh55

COPY package.json .
RUN NODE_ENV=$NODE_ENV yarn install --frozen-lockfile --silent
COPY . .
EXPOSE 3000
CMD [ "yarn", "run", "start" ]
16 changes: 16 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,19 @@
[![Build Status](https://travis-ci.com/jasonwalsh/prototype.svg?token=kDZcsygosGgqF2WJJ1jZ&branch=master)](https://travis-ci.com/jasonwalsh/prototype)

## Docker

This repository uses Docker [Community Edition](https://www.docker.com/community-edition) (CE) version `18.03.0-ce`.

$ docker-compose up -d

The `-d` flag instructs Docker to run the containers in 'detached' mode.

## Testing

$ docker-compose -f docker-compose.test.yml up

## Deployment

The following repository contains the Terraform configurations for the Heroku deployment pipeline: https://github.com/jasonwalsh/terraform-configurations.

Please refer to the README for instructions on creating the necessary pipeline resources.
8 changes: 8 additions & 0 deletions docker-compose.test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
services:
sut:
build:
args:
NODE_ENV: development
context: .
command: yarn run test
version: '3.6'
13 changes: 13 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
services:
bot:
build: .
environment:
ACCESS_TOKEN: '${ACCESS_TOKEN:?err}'
PORT: '${PORT:-3000}'
VERIFY_TOKEN: '${VERIFY_TOKEN:?err}'
ports:
- 3000:3000
volumes:
- .:/srv
- /srv/node_modules
version: '3.6'