Skip to content

Instantly share code, notes, and snippets.

View Philmod's full-sized avatar

Philippe Modard Philmod

View GitHub Profile
@Philmod
Philmod / cloudbuild.yaml
Created January 12, 2019 16:15
many docker tags
steps:
- name: 'gcr.io/cloud-builders/docker'
args: ['build', '-t', 'gcr.io/$PROJECT_ID/my-image:latest', '-t', 'gcr.io/$PROJECT_ID/my-image:$SHORT_SHA', '.']
images: ['gcr.io/$PROJECT_ID/my-image:latest', 'gcr.io/$PROJECT_ID/my-image:$SHORT_SHA']
@Philmod
Philmod / redate.sh
Created October 8, 2018 21:30
Script to redate pictures using offset
#!/bin/bash
for f in DSC_*.*; do
ts="$(GetFileInfo -d "$f")"
e="$(date -j -f "%m/%d/%Y %H:%M:%S" "$ts" +%s)"
((o=304730220))
((e+=o))
nd="$(date -r $e "+%m/%d/%Y %H:%M:%S")"
echo "$nd"
SetFile -m "$nd" "$f"
SetFile -d "$nd" "$f"
@Philmod
Philmod / cloudbuild.yaml
Created February 12, 2018 21:30
Build a nodejs app with 2 different nodejs versions
steps:
- name: 'gcr.io/cloud-builders/docker'
args: ['build', '--build-arg', 'node_version=${_NODE_VERSION_1}', '-t', 'gcr.io/$PROJECT_ID/build-substitutions-nodejs-${_NODE_VERSION_1}', '.']
wait_for: '-'
- name: 'gcr.io/cloud-builders/docker'
args: ['build', '--build-arg', 'node_version=${_NODE_VERSION_2}', '-t', 'gcr.io/$PROJECT_ID/build-substitutions-nodejs-${_NODE_VERSION_2}', '.']
wait_for: '-'
images: ['gcr.io/$PROJECT_ID/build-substitutions-nodejs-${_NODE_VERSION_1}', 'gcr.io/$PROJECT_ID/build-substitutions-nodejs-${_NODE_VERSION_2}']
@Philmod
Philmod / cloudbuild.yaml
Created February 9, 2018 19:02
Side container to keep track of docker stats during GCB build steps
steps:
# Run docker stats in the background.
# --no-stream is used in order to print the stats on different lines.
- name: 'gcr.io/cloud-builders/docker'
args:
- 'run'
- '-d'
- '--name=docker-stats'
- '--volume=/var/run/docker.sock:/var/run/docker.sock'
- '--entrypoint=/bin/bash'
@Philmod
Philmod / cloudbuild.yaml
Created January 23, 2018 15:17
Create a Go binary with GCB.
steps:
# Install dependencies.
- name: 'gcr.io/cloud-builders/go'
args: ['install', '.']
env: ['PROJECT_ROOT=hello']
# Run tests.
- name: 'gcr.io/cloud-builders/go'
args: ['test', 'hello']
env: ['PROJECT_ROOT=hello']
# Create binary.
import matplotlib.pyplot as plt
import numpy as np
import time
%matplotlib notebook
x = np.linspace(0, 10*np.pi, 100)
y = np.sin(x)
plt.ion()
@Philmod
Philmod / cloudbuild.yaml
Created December 1, 2017 18:13
Simple GCB example for node.js
steps:
- name: 'gcr.io/cloud-builders/npm'
args: ['install']
- name: 'gcr.io/cloud-builders/npm'
args: ['test']
- name: 'gcr.io/cloud-builders/docker'
args: ["build", "-t", "gcr.io/$PROJECT_ID/my-image", "."]
images: ["gcr.io/$PROJECT_ID/my-image"]
@Philmod
Philmod / cloudbuild.yaml
Created October 19, 2017 16:18
GCB with deploy to GKE
steps:
- name: 'gcr.io/cloud-builders/docker'
args: ["build", "-t", "gcr.io/$PROJECT_ID/birthday:$REVISION_ID", "."]
- name: 'gcr.io/cloud-builders/docker'
args: ["push", "gcr.io/$PROJECT_ID/birthday:$REVISION_ID"]
- name: 'gcr.io/cloud-builders/kubectl'
args: ['set', 'image', 'deployment/birthday', 'birthday=gcr.io/$PROJECT_ID/birthday:$REVISION_ID']
env:
- 'CLOUDSDK_COMPUTE_ZONE=us-east1-b'
- 'CLOUDSDK_CONTAINER_CLUSTER=node-example-cluster'
@Philmod
Philmod / cloudbuild.yaml
Created September 21, 2017 13:18
concurrent docker builds on Google Container Builder
steps:
- name: 'gcr.io/cloud-builders/docker'
args:
- 'build'
- '-f'
- 'Dockerfile.alpine'
- '-t'
- 'gcr.io/$PROJECT_ID/large-docker-alpine:latest'
- '.'
waitFor: ['-']
@Philmod
Philmod / cloudbuild.yaml
Last active October 10, 2017 21:10
Parallel push to the 3 GCR registries
steps:
- name: 'gcr.io/cloud-builders/docker'
args:
- 'build'
- '-t'
- 'us.gcr.io/$PROJECT_ID/test'
- '-t'
- 'asia.gcr.io/$PROJECT_ID/test'
- '-t'
- 'eu.gcr.io/$PROJECT_ID/test'