Skip to content

Instantly share code, notes, and snippets.

@ytakky2014
ytakky2014 / dockerfilebuild.md
Created June 20, 2017 12:17
Docker file build option memo

Dockerfileのbuildオプション

いつも docker build -t [tag] . でやっているけど、

docker build -t [tag] -f [Dockerfile名] [Dockerfile名があるディレクトリ]で割りとフレキシブルにビルドできる。

例えば /dockerfile/myDockerfileがあって、 /で実行するときは

 docker build -t tag -f ./dockerfile/myDockerfile ./dockerfile 
@ytakky2014
ytakky2014 / use_watson_visual_recognition.php
Created November 28, 2016 10:57
Use Watson Visual Recognition Sample
<?php
$api_url = env('WATSON_RECOGNITION_API_URL');
$api_key = env('WATSON_RECOGNITION_API_KEY');
$api_mode = "v3/classify";
$curl = new Curl();
$curl_url = $api_url . $api_mode;
$image_path = 'image_path';
$curl->get($curl_url, array(
'url' => $image_path,
'classifier_ids' => 'default',
@ytakky2014
ytakky2014 / use_docomo.php
Created November 28, 2016 10:56
Use Docomo Image API Sample
<?php
$file = file_get_contents($image_path);
$ch = curl_init();
curl_setopt_array($ch,[
CURLOPT_URL => $api_url . '?APIKEY=' . $api_key,
CURLOPT_RETURNTRANSFER => true,
CURLOPT_POST => true,
CURLOPT_POSTFIELDS => [
'modelName' => 'food',
'image' => new CURLFile($image_path)
@ytakky2014
ytakky2014 / use_cloudvision.php
Created November 28, 2016 10:55
Use Google Cloud Vision Sample
<?php
use Curl\Curl;
$api_url = env('GOOGLE_CLOUDVISION_API_URL');
$api_key = env('GOOGLE_CLOUDVISION_API_KEY');
$curl = new Curl();
$curl_url = $api_url . $api_key;
$curl->setHeader('Content-Type', 'application/json');
$image_path = 'image_path';
$file = file_get_contents($image_path);
$send_json = json_encode([
@ytakky2014
ytakky2014 / use_imagga.php
Created November 28, 2016 10:54
Use Imagga API Sample
<?php
use Curl\Curl;
$curl_url = "https://api.imagga.com/v1/tagging"
$curl = new Curl();
$curl->setopt(CURLOPT_HEADER, FALSE);
$curl->setopt(CURLOPT_RETURNTRANSFER, TRUE);
$curl->setBasicAuthentication($api_key, $api_secret);
$curl->get($curl_url, array(
'url' => $file,
'language' => 'ja'