Skip to content

Instantly share code, notes, and snippets.

View Timtech4u's full-sized avatar
🎯
Focusing

Timothy Olaleke Timtech4u

🎯
Focusing
View GitHub Profile
FROM node:8.9.4-alpine
RUN apk add --no-cache git
RUN npm install -g yo generator-hubot
RUN adduser -D hubot
USER hubot
WORKDIR /home/hubot
RUN yo hubot --owner="Tim <timothy@fireflies.ai>" --name="hubot" --description="Hubot for slack" --adapter="slack" --defaults
RUN npm install --save hubot-slack
RUN npm install --save hubot-google-images
RUN npm install --save hubot-google-translate
confirmations:
required: 4 # choose the number of confirmations you require
policyengine.simple:
fixedGasPrice: null
gasOracle:
mode: connector
@Timtech4u
Timtech4u / cloudbuild.yaml
Created January 12, 2021 07:20
Generic Cloud Build
steps:
# build and push container
- name: "gcr.io/kaniko-project/executor:latest"
args: ["--cache=true", "--cache-ttl=48h", "--destination=gcr.io/$PROJECT_ID/$REPO_NAME:$BRANCH_NAME"]
# deploy container image to Cloud Run with env vars
- name: "gcr.io/cloud-builders/gcloud"
args: ['run', 'deploy', '$REPO_NAME', '--image', 'gcr.io/$PROJECT_ID/$REPO_NAME:$BRANCH_NAME', '--region', 'europe-west4', '--allow-unauthenticated', '--platform', 'managed', '--update-env-vars', 'NODE_ENV=prod']
# set full traffic to latest revision (needed if rollback was performed)
- name: "gcr.io/cloud-builders/gcloud"
args: ['run', 'services', 'update-traffic', '$REPO_NAME', '--to-latest', '--region', 'europe-west4', '--platform', 'managed']
# File: cloudbuild.yaml
steps:
# build the container image
- name: 'gcr.io/cloud-builders/docker'
args: [ 'build', '-t', 'gcr.io/$PROJECT_ID/demo-app', '.' ]
# push the container image
- name: 'gcr.io/cloud-builders/docker'
args: [ 'push', 'gcr.io/$PROJECT_ID/demo-app']
# deploy to Cloud Run
- name: "gcr.io/cloud-builders/gcloud"
# File: .gitlab-ci.yml
image: docker:latest
stages:
- deploy
deploy:
stage: deploy
image: google/cloud-sdk
services:
@Timtech4u
Timtech4u / garden.yml
Last active March 11, 2020 14:44
Garden configuration file
# garden.yml
kind: Project
name: flask-app
environments:
- name: dev
providers:
- name: kubernetes
context: gke_fullstackgcp_us-central1-c_my-dev-cluster
buildMode: cluster-docker
defaultEnvironment: dev
@Timtech4u
Timtech4u / main.tf
Last active January 23, 2020 18:55
Deploy to Cloud Run using Terraform
# Configure GCP project
provider "google" {
project = "terraform-cr"
}
# Deploy image to Cloud Run
resource "google_cloud_run_service" "mywebapp" {
name = "mywebapp"
location = "us-central1"
template {
@Timtech4u
Timtech4u / Dockerfile
Last active March 20, 2020 08:47
Hello World - A Containerized Flask Web Application
FROM python:3.7-stretch
RUN apt-get update -y
RUN apt-get install -y python-pip python-dev build-essential
COPY . /app
WORKDIR /app
RUN pip install -r requirements.txt
ENTRYPOINT ["python"]
CMD ["main.py"]
@Timtech4u
Timtech4u / app.yaml
Last active July 26, 2020 21:04
Hello World - Flask Web Application
runtime: python37
@Timtech4u
Timtech4u / main.py
Last active January 5, 2020 09:50
Simple Hello App in Python(Flask)
from flask import jsonify
def hello_world(request):
"""Responds to any HTTP request.
"""
return jsonify({"message": "Hello World"})