Skip to content

Instantly share code, notes, and snippets.

View AndrewBestbier's full-sized avatar

Andrew AndrewBestbier

  • McKinsey & Company
  • London
View GitHub Profile
const AWS = require("aws-sdk");
const crypto = require("crypto");
// Generate unique id with no external dependencies
const generateUUID = () => crypto.randomBytes(16).toString("hex");
// Initialising the DynamoDB SDK
const documentClient = new AWS.DynamoDB.DocumentClient();
exports.handler = async event => {
version: 0.2
phases:
install:
runtime-versions:
nodejs: 10 # (1)
commands:
- echo "$DOCKER_PASS" | docker login -u "$DOCKER_USER" --password-stdin # (2)
pre_build:
commands:
- pipeline: "CI Blog Post"
trigger_mode: "ON_EVERY_PUSH"
ref_name: "master"
ref_type: "BRANCH"
trigger_condition: "ALWAYS"
actions:
- action: "Execute: yarn test"
type: "BUILD"
working_directory: "/buddy/ci-comparison-blog"
docker_image_name: "library/node"
@AndrewBestbier
AndrewBestbier / .travis.yml
Last active October 19, 2019 13:07
.travis.yml
language: node_js # (1)
node_js:
- 'node'
services:
- docker # (2)
jobs:
include:
- stage: test
script:
- npm install # (3)
image: node:latest # (1)
stages:
- build
- test
- docker-deploy-image
- aws-deploy
cache:
paths:
branch-defaults:
master:
environment: CiComparisonBlog-env
environment-defaults:
CiComparisonBlog-env:
branch: null
repository: null
global:
application_name: CI Comparison Blog
default_ec2_keyname: null
version: 2
jobs:
test:
working_directory: ~/app
docker:
- image: circleci/node:latest # (1)
steps:
- checkout
- run:
name: Update npm
const addOne = (input) => {
return input +=1;
)} // Notice the rogue ')' here
{
"AWSEBDockerrunVersion": "1",
"Image": {
"Name": "andrewbest/node-docker-eb"
},
"Ports": [
{
"ContainerPort": "3000"
}
]
@AndrewBestbier
AndrewBestbier / Dockerfile
Last active August 22, 2019 22:06
Dockerfile
# Use an official Node runtime as a parent image
FROM node:12.7.0-alpine
# Set the working directory to /app
WORKDIR '/app'
# Copy package.json to the working directory
COPY package.json .
# Install any needed packages specified in package.json