Commit 6ca4631e authored by O'Reilly Media, Inc.'s avatar O'Reilly Media, Inc.
Browse files

Initial commit

parents
Loading
Loading
Loading
Loading
+7 −0
Changes for Deploying Docker Containers to Amazon Web Services - Working Files/Chapter 1/No Work Files.rtf: 7 added lines, 0 removed lines.
Original line number Diff line number Diff line
{\rtf1\ansi\ansicpg1252\cocoartf1038\cocoasubrtf350
{\fonttbl\f0\fswiss\fcharset0 Helvetica;}
{\colortbl;\red255\green255\blue255;}
\margl1440\margr1440\vieww9000\viewh8400\viewkind0
\pard\tx720\tx1440\tx2160\tx2880\tx3600\tx4320\tx5040\tx5760\tx6480\tx7200\tx7920\tx8640\ql\qnatural\pardirnatural

\f0\fs24 \cf0 No work files for this lesson...}
 No newline at end of file
+11 −0
Changes for Deploying Docker Containers to Amazon Web Services - Working Files/Chapter 2/Dockerfile: 11 added lines, 0 removed lines.
Original line number Diff line number Diff line
FROM node:0.12.1-slim

EXPOSE 8080

ADD package.json package.json

RUN npm install --save

ADD app.js app.js

CMD node app.js
+36 −0
Changes for Deploying Docker Containers to Amazon Web Services - Working Files/Chapter 2/app.js: 36 added lines, 0 removed lines.
Original line number Diff line number Diff line
/* A simple web service for O'Reilly's Docker on AWS video series
 *
 * This service exposes four endpoints:
 * - GET /        - Returns 200 with JSON body containing the current service
 *                  count.
 * - GET /version - Returns JSON describing the service version.
 * - PUT /inc     - Increment the service count. Returns 204.
 * - PUT /dec     - Decrement the service count. Returns 204.
 */

var express = require('express');
var morgan = require('morgan');

var PORT = process.env.PORT || 8080;
var count = 0;

var app = express();

app.use(morgan('[:date[iso]] :method :url\t:status'));

app.get('/', function (req, res) {
  res.status(200).send({count: count});
});

app.put('/inc', function (req, res) {
  count += 1;
  res.status(204).end();
});

app.put('/dec', function (req, res) {
  count -= 1;
  res.status(204).end();
});

app.listen(PORT);
console.log('Running on http://localhost:' + PORT);
+3 −0
Changes for Deploying Docker Containers to Amazon Web Services - Working Files/Chapter 2/build.sh: 3 added lines, 0 removed lines.
Original line number Diff line number Diff line
#!/usr/bin/env bash

docker build --tag rkneufeld/sample-service:simple .
+16 −0
Changes for Deploying Docker Containers to Amazon Web Services - Working Files/Chapter 2/package.json: 16 added lines, 0 removed lines.
Original line number Diff line number Diff line
{
  "name": "sample-service",
  "version": "1.0.0",
  "private": true,
  "description": "A sample service for O'Reilly's Docker on AWS video",
  "author": "Ryan Neufeld <ryan@rkn.io>",
  "license": "MIT",
  "dependencies": {
    "express": "4.12.3",
    "morgan": "1.5.2"
  },
  "repository": {
    "type": "git",
    "url": "https://github.com/rkneufeld/docker-on-aws.git"
  }
}
Loading