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
dhavaln / README.md
Created Oct 16, 2019
Docker for Mac Volumes
View README.md

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

Test Values

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

Local Testing

gcloud beta auth application-default login
@dhavaln
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
dhavaln / serverless.yml
Created Jun 8, 2019
Serverless Hello World Layer Package
View serverless.yml
# layers
layers:
moment:
path: ../layers/moment-layer
compatibleRuntimes:
- nodejs8.10
package:
include:
- node_modules/**
@dhavaln
dhavaln / handler.js
Created Jun 8, 2019
Serverless Hello World Layer Dependency
View handler.js
'use strict';
const
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
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.