Skip to content

Instantly share code, notes, and snippets.

I may be slow to respond.

dhaval nagar dhavaln

I may be slow to respond.
Block or report user

Report or block dhavaln

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
dhavaln /
Created Oct 16, 2019
Docker for Mac Volumes

Only for Docker for Mac

Screen into the Docker Desktop

screen /Users/dhavalnagar/Library/Containers/com.docker.docker/Data/vms/0/tty

List the Volumes Directory

ls /var/lib/docker/volumes/

dhavaln / Dockerfile
Created Oct 13, 2019
Simple NodeJS Multistage Build
View Dockerfile
FROM node:10 as build
LABEL description="This is a multi-stage NodeJS image"
COPY package*.json .
RUN npm install
COPY . .
FROM node:10-slim
dhavaln / Dockerfile
Created Oct 11, 2019
hello-app source for CodeCommit and CodeBuild
View Dockerfile
FROM alpine
LABEL description="Part 1 - Running Docker on AWS EC2"
RUN echo "Hello world" > hello.txt
CMD ["cat", "hello.txt"]
dhavaln /
Last active Oct 11, 2019
Install Docker on EC2
#! /bin/sh
yum update -y
amazon-linux-extras install docker
service docker start
usermod -a -G docker ec2-user
chkconfig docker on
dhavaln / simple.txt
Created Oct 2, 2019
Docker Inline Demo
View simple.txt
# Demo1: This is an inline build
docker build -t inlineimage -f- . <<EOF
FROM node:10
WORKDIR /usr/src
RUN echo "console.log('hello world');" > index.js
CMD ["node", "index.js"]
dhavaln /
Last active Aug 22, 2019
Compute calls from Cloud Function

Test Values

Make sure you change the project and firewall resource Ids of your environment.

Local Testing

gcloud beta auth application-default login
dhavaln / cmd.txt
Created Jul 3, 2019
AWS KMS encrypt/decrypt
View cmd.txt
aws kms encrypt --key-id <key id> --plaintext "Hello world" --profile <user profile> --output text --query CiphertextBlob | base64 --decode > encryptedtext
aws kms decrypt --ciphertext-blob fileb://encryptedtext --output text --query Plaintext --profile <user profile> | base64 --decode
dhavaln / serverless.yml
Created Jun 8, 2019
Serverless Hello World Layer Package
View serverless.yml
# layers
path: ../layers/moment-layer
- nodejs8.10
- node_modules/**
dhavaln / handler.js
Created Jun 8, 2019
Serverless Hello World Layer Dependency
View handler.js
'use strict';
moment = require('moment');
module.exports.helloWorld = (event, context, callback) => {
const response = {
statusCode: 200,
headers: {
'Access-Control-Allow-Origin': '*', // Required for CORS support to work
dhavaln / output.txt
Created Jun 8, 2019
Serverless Hello World Layer Deployment Output
View output.txt
Serverless: Packaging service...
Serverless: Excluding development dependencies...
Serverless: Excluding development dependencies...
Serverless: Uploading CloudFormation file to S3...
Serverless: Uploading artifacts...
Serverless: Uploading service .zip file to S3 (1.07 KB)...
Serverless: Uploading service .zip file to S3 (839 KB)...
Serverless: Validating template...
Serverless: Updating Stack...
Serverless: Checking Stack update progress...
You can’t perform that action at this time.