SlideShare a Scribd company logo
1 of 30
Download to read offline
Develop With Docker
Linking Error
by qrtt1
HELP !!!
Develop With Docker
關於標題
Develop With Docker
最近在忙什麼
• 搞雲端、寫 Java、寫 Python、不想,但又得寫 C
• ⾃自⼰己的 CDN ⾃自⼰己建
• ⾃自⼰己的雲端播放器⾃自⼰己做
Develop With Docker
今天要講什麼
• ⾃自⼰己的雲端播放器⾃自⼰己建之⼀一⼩小部分
http://bit.ly/1ByJSVZ
Develop With Docker
編譯是個苦工
Internet of Things
Cross Compilation
潮
苦
Develop With Docker
• 同事A:裝不起來啊~~
• 同事B:怎麼弄的!?
• 同事C:剛剛還可以的啊!!!
• 同事X:幫我弄⼀一下
• 同事Z:Linux … 不熟哩~
準備開發環境
悲
苦
Develop With Docker
還有編譯腳本
• 年年向⿊黑道宣戰的男⼈人
• 這是 qrtt1 第 N 次向 AutoTools 宣戰
• 別說 AutoTools 了,連 Makefile 都寫得不忍直視
• 如何避免能⼒力有限形成的 Copy & Paste 世界奇觀:
• Makefile.vendor[a-zA-z0-9]+
Develop With Docker
助人為快樂之本
• [打算] 在 VM 環境好開發環境打包給同事使⽤用
• [vendor A] 要⽤用 fedora 8 裝他們的 toolchain
• [vendor B] 要⽤用 ubuntu 裝他們的 toolchain
• [vendor N] 要⽤用 xxxxxx 裝他們的 toolchain
• 天殺的到底需要做幾個開發環境!?
Develop With Docker
提案
• 建個 VM 環境,把所有東⻄西都安裝去上,再 export
發給需要開發的同事
• VM 開發環境的缺點
• 檔案較佔空間
• 執⾏行需要的資源較多
• 部分更新較不⽅方便
Develop With Docker
各式格樣的組合
開發環境 For Vendor [a-zA-z0-9]+
編譯腳本 for Vendor [a-zA-z0-9]+
X
Develop With Docker
問題摘要
• 如何免除開發環境建置、維護的負擔
• toolchain 更新
• 相依 library 更新
• 如何維護各種 toolchain 的 Makefile
Develop With Docker
• 傳統的 Servers 管理
• 使⽤用⼯工⼈人智慧,⼀一⼀一建⽴立需要的 Server
• 每次需耗損較多的⼯工⼈人時間,品質依⼯工⼈人⼼心情⽽而定
• 雲端⾵風格的 Servers 管理
• 使⽤用宣告式腳本,描述應該建⽴立的 Server
• 使⽤用⼯工具依腳本建⽴立,品質相對穩定
向雲端借鏡
Develop With Docker
Infrastructure as Code
• 基礎建設即為程式碼,例如雲端服務 AWS
CloudFormation; DevOps ⼯工具: Ansible, Chef,
Puppet
• 程式碼
• ⽅方便透過版本控制系統管理
• 狀態容易 reproduce
• 最終成果可拋式(Disposable)
Develop With Docker
• Vagrant: https://www.vagrantup.com/
• Provision ⼯工具:依腳本建⽴立出需要的 VM 環境
或 Docker Container
• Docker: https://www.docker.com/
• Linux Container 管理⼯工具:依腳本建出需要的
Docker Image
開發環境 as Code
Develop With Docker
Docker
• Docker 官網 

https://www.docker.com/

https://www.docker.com/tryit/ Docker 練習環境
• The Docker Ecosystem: An Introduction to Common
Components

http://bit.ly/1BE2WIc
• Docker 101 - Intro to Docker 

http://slidesha.re/1LxLOpD
• 深⼊入浅出Docker(⼀一):Docker核⼼心技术预览

http://bit.ly/1LxLRBN
Develop With Docker
Docker vs VM
http://bit.ly/1A6ETAd
輕
盈
Develop With Docker
• build a image from the Dockerfile
• run a container from the image
• show the history of a image
• commit changes of a container to a new image
• stop, start, rm a container; rmi a image
Docker Command
Develop With Docker
Dockerfile
• Image 建⽴立腳本
FROM ubuntu:14.04.1
RUN apt-get update -y
RUN apt-get install -y cmake
RUN apt-get install -y vim
RUN apt-get install -y wget tree
ADD scripts/bashrc /.bashrc
WORKDIR /data
Develop With Docker
Any Question Before Demonstration 

Docker Basic Commands
Develop With Docker
[文件]製作開發環境
• 設想⼀一下⼀一般的⽂文件會看到什麼...
• 啟動 docker for vendor A
• 把 vendor A 的 toolchain.tgz 解到 /opt/vendorA/
• 開始編譯 XXX Library ⾄至 /opt/vendorA/XXX
• 開始編譯 YYY Library ⾄至 /opt/vendorA/YYY
• 把它 tar 起來,上傳⾄至 s3 後續使⽤用
WTF
Develop With Docker
開發環境
我只想要⼀一個 

build-image.sh
Develop With Docker
Any Question Before Demonstration 

Build Images For VENDORs
Develop With Docker
開發環境
• 安裝 toolchain 與相關開發⼯工具
• 編譯相依 Libraries
• prefix: /opt/vendor
• 將上述需求整理成 script 與 Dockerfile
• docker build -t acme/vendor .
• 接著我們能這麼使⽤用
• docker run -ti acme/vendor /bin/bash …
Develop With Docker
專案輔助腳本
• 進⼊入 docker container
• docker-run.sh vendor
• docker run -ti acme/vendor /bin/bash
• 編譯專案
• docker-build.sh vendor
• docker run -ti acme/vendor /bin/bash build.sh
Develop With Docker
CMake
• Don’t Be Autofools
• 模組化設計,需要 OOO 功能就引⽤用 OOO 模組
• 學習撰寫、改寫 find_package
• 開發中的 library 常在⾮非系統預設路徑,適度的改
寫與客製化是必要的。http://bit.ly/1DmrtO3
• 範例:FindLibAO.cmake http://bit.ly/1DmtDgB
Develop With Docker
• CMake 2.6.0 後開始⽀支援 Cross compiling

http://bit.ly/1DmsBRN
• 將需要 Cross Compiling 設定的變數定義出來,並能
將設定獨⽴立在專屬的檔案內
Cross Compiling
cmake 
-DCMAKE_TOOLCHAIN_FILE=toolchain_vendor.cmake .
One vendor, One toolchain file
Develop With Docker
Any Question Before Demonstration 

Build our Project
Develop With Docker
組合的力量
Docker Image For Vendor [a-zA-z0-9]+
CMake Toolchain File for Vendor [a-zA-z0-9]+
X
Develop With Docker
• 如何免除開發環境建置、維護的負擔
• 如何優雅地寫出符合各種 toolchain 的 Makefile
複習一下
用 Docker,一人努力,多人享受
CMake + Find_Package + ToolchainFile
Develop With Docker
Q & A

More Related Content

What's hot

從軟體開發角度
談 Docker 的應用
從軟體開發角度
談 Docker 的應用從軟體開發角度
談 Docker 的應用
從軟體開發角度
談 Docker 的應用謝 宗穎
 
容器式軟體開發介紹
容器式軟體開發介紹容器式軟體開發介紹
容器式軟體開發介紹Philip Zheng
 
Docker 淺入淺出
Docker 淺入淺出Docker 淺入淺出
Docker 淺入淺出Miles Chou
 
COSCUP 2016 Workshop: 用 Docker 架設班級 git-it 練習環境
COSCUP 2016 Workshop: 用 Docker 架設班級 git-it 練習環境COSCUP 2016 Workshop: 用 Docker 架設班級 git-it 練習環境
COSCUP 2016 Workshop: 用 Docker 架設班級 git-it 練習環境均民 戴
 
開發人員不可不知的 Windows Container 容器技術預覽
開發人員不可不知的 Windows Container 容器技術預覽開發人員不可不知的 Windows Container 容器技術預覽
開發人員不可不知的 Windows Container 容器技術預覽Will Huang
 
用 Drone 打造 輕量級容器持續交付平台
用 Drone 打造輕量級容器持續交付平台用 Drone 打造輕量級容器持續交付平台
用 Drone 打造 輕量級容器持續交付平台Bo-Yi Wu
 
Docker 最佳实践
Docker 最佳实践Docker 最佳实践
Docker 最佳实践YuLing Liu
 
讓軟體開發與應用更自由 - 使用 Docker 技術
讓軟體開發與應用更自由 - 使用 Docker 技術讓軟體開發與應用更自由 - 使用 Docker 技術
讓軟體開發與應用更自由 - 使用 Docker 技術Yu Lung Shao
 
20150604 docker 新手入門
20150604 docker 新手入門20150604 docker 新手入門
20150604 docker 新手入門azole Lai
 
認識那條鯨魚 Docker 初探
認識那條鯨魚   Docker 初探認識那條鯨魚   Docker 初探
認識那條鯨魚 Docker 初探仲昀 王
 
Docker Compose
Docker ComposeDocker Compose
Docker ComposeMiles Chou
 
Docker tutorial
Docker tutorialDocker tutorial
Docker tutorialazole Lai
 
Docker初识
Docker初识Docker初识
Docker初识hubugui
 
Docker workshop
Docker workshopDocker workshop
Docker workshopWei Tung
 
AWS EC2 for beginner
AWS EC2 for beginnerAWS EC2 for beginner
AWS EC2 for beginnerazole Lai
 
Rancher: 建立你的牧場艦隊
Rancher: 建立你的牧場艦隊Rancher: 建立你的牧場艦隊
Rancher: 建立你的牧場艦隊Miles Chou
 
用 Docker 改善團隊合作模式
用 Docker 改善團隊合作模式用 Docker 改善團隊合作模式
用 Docker 改善團隊合作模式Bo-Yi Wu
 

What's hot (20)

從軟體開發角度
談 Docker 的應用
從軟體開發角度
談 Docker 的應用從軟體開發角度
談 Docker 的應用
從軟體開發角度
談 Docker 的應用
 
Docker基礎
Docker基礎Docker基礎
Docker基礎
 
容器式軟體開發介紹
容器式軟體開發介紹容器式軟體開發介紹
容器式軟體開發介紹
 
Docker 淺入淺出
Docker 淺入淺出Docker 淺入淺出
Docker 淺入淺出
 
COSCUP 2016 Workshop: 用 Docker 架設班級 git-it 練習環境
COSCUP 2016 Workshop: 用 Docker 架設班級 git-it 練習環境COSCUP 2016 Workshop: 用 Docker 架設班級 git-it 練習環境
COSCUP 2016 Workshop: 用 Docker 架設班級 git-it 練習環境
 
開發人員不可不知的 Windows Container 容器技術預覽
開發人員不可不知的 Windows Container 容器技術預覽開發人員不可不知的 Windows Container 容器技術預覽
開發人員不可不知的 Windows Container 容器技術預覽
 
用 Drone 打造 輕量級容器持續交付平台
用 Drone 打造輕量級容器持續交付平台用 Drone 打造輕量級容器持續交付平台
用 Drone 打造 輕量級容器持續交付平台
 
Docker 最佳实践
Docker 最佳实践Docker 最佳实践
Docker 最佳实践
 
讓軟體開發與應用更自由 - 使用 Docker 技術
讓軟體開發與應用更自由 - 使用 Docker 技術讓軟體開發與應用更自由 - 使用 Docker 技術
讓軟體開發與應用更自由 - 使用 Docker 技術
 
20150604 docker 新手入門
20150604 docker 新手入門20150604 docker 新手入門
20150604 docker 新手入門
 
認識那條鯨魚 Docker 初探
認識那條鯨魚   Docker 初探認識那條鯨魚   Docker 初探
認識那條鯨魚 Docker 初探
 
Docker Compose
Docker ComposeDocker Compose
Docker Compose
 
Docker tutorial
Docker tutorialDocker tutorial
Docker tutorial
 
認識 Docker
認識 Docker認識 Docker
認識 Docker
 
Docker初识
Docker初识Docker初识
Docker初识
 
Docker Build
Docker BuildDocker Build
Docker Build
 
Docker workshop
Docker workshopDocker workshop
Docker workshop
 
AWS EC2 for beginner
AWS EC2 for beginnerAWS EC2 for beginner
AWS EC2 for beginner
 
Rancher: 建立你的牧場艦隊
Rancher: 建立你的牧場艦隊Rancher: 建立你的牧場艦隊
Rancher: 建立你的牧場艦隊
 
用 Docker 改善團隊合作模式
用 Docker 改善團隊合作模式用 Docker 改善團隊合作模式
用 Docker 改善團隊合作模式
 

Similar to Linking error

Docker 基礎介紹與實戰
Docker 基礎介紹與實戰Docker 基礎介紹與實戰
Docker 基礎介紹與實戰Bo-Yi Wu
 
Weic2015 docker
Weic2015 dockerWeic2015 docker
Weic2015 dockerRay Lin
 
A brief introduction to Vagrant – 原來 VirtualBox 可以這樣玩
A brief introduction to Vagrant – 原來 VirtualBox 可以這樣玩A brief introduction to Vagrant – 原來 VirtualBox 可以這樣玩
A brief introduction to Vagrant – 原來 VirtualBox 可以這樣玩Wen-Tien Chang
 
桃園市教育局Docker技術入門與實作
桃園市教育局Docker技術入門與實作桃園市教育局Docker技術入門與實作
桃園市教育局Docker技術入門與實作Philip Zheng
 
Flutter 踩雷心得
Flutter 踩雷心得Flutter 踩雷心得
Flutter 踩雷心得Weizhong Yang
 
[2020 .NET Conf] 企業Azure DevOps Service 實際應用架構與秘辛
[2020 .NET Conf] 企業Azure DevOps Service 實際應用架構與秘辛[2020 .NET Conf] 企業Azure DevOps Service 實際應用架構與秘辛
[2020 .NET Conf] 企業Azure DevOps Service 實際應用架構與秘辛Edward Kuo
 
快速入坑 Node.js - 0613 SITCON 雲林定期聚
快速入坑 Node.js - 0613 SITCON 雲林定期聚快速入坑 Node.js - 0613 SITCON 雲林定期聚
快速入坑 Node.js - 0613 SITCON 雲林定期聚Lorex L. Yang
 
Docker open stack
Docker open stackDocker open stack
Docker open stackGuangya Liu
 
Docker
DockerDocker
DockerNCUDSC
 
Azure Container Registry(preview)x Web App On Linux(preview)
Azure Container Registry(preview)x Web App On Linux(preview)Azure Container Registry(preview)x Web App On Linux(preview)
Azure Container Registry(preview)x Web App On Linux(preview)Ch Rick
 
專案啟動與設定
專案啟動與設定專案啟動與設定
專案啟動與設定Shengyou Fan
 
透過Nuget管理內部共用元件
透過Nuget管理內部共用元件透過Nuget管理內部共用元件
透過Nuget管理內部共用元件昱劭 劉
 
Docker一期培训
Docker一期培训Docker一期培训
Docker一期培训青帅 常
 
Azure Container Service 使用 DC / OS 管理 docker 容器
Azure Container Service 使用 DC / OS 管理 docker 容器Azure Container Service 使用 DC / OS 管理 docker 容器
Azure Container Service 使用 DC / OS 管理 docker 容器Ch Rick
 
当当网Docker应用实践
当当网Docker应用实践当当网Docker应用实践
当当网Docker应用实践正炎 高
 
快速上手 Windows Containers 容器技術 (Docker Taipei)
快速上手 Windows Containers 容器技術 (Docker Taipei)快速上手 Windows Containers 容器技術 (Docker Taipei)
快速上手 Windows Containers 容器技術 (Docker Taipei)Will Huang
 
WOT Cloud Computing Architect Summit
WOT Cloud Computing Architect SummitWOT Cloud Computing Architect Summit
WOT Cloud Computing Architect SummitDocker, Inc.
 
FHIR Server 安裝與使用
FHIR Server 安裝與使用FHIR Server 安裝與使用
FHIR Server 安裝與使用Lorex L. Yang
 

Similar to Linking error (20)

Docker 基礎介紹與實戰
Docker 基礎介紹與實戰Docker 基礎介紹與實戰
Docker 基礎介紹與實戰
 
Weic2015 docker
Weic2015 dockerWeic2015 docker
Weic2015 docker
 
Docker 101
Docker 101Docker 101
Docker 101
 
Docker基礎
Docker基礎Docker基礎
Docker基礎
 
A brief introduction to Vagrant – 原來 VirtualBox 可以這樣玩
A brief introduction to Vagrant – 原來 VirtualBox 可以這樣玩A brief introduction to Vagrant – 原來 VirtualBox 可以這樣玩
A brief introduction to Vagrant – 原來 VirtualBox 可以這樣玩
 
桃園市教育局Docker技術入門與實作
桃園市教育局Docker技術入門與實作桃園市教育局Docker技術入門與實作
桃園市教育局Docker技術入門與實作
 
Flutter 踩雷心得
Flutter 踩雷心得Flutter 踩雷心得
Flutter 踩雷心得
 
[2020 .NET Conf] 企業Azure DevOps Service 實際應用架構與秘辛
[2020 .NET Conf] 企業Azure DevOps Service 實際應用架構與秘辛[2020 .NET Conf] 企業Azure DevOps Service 實際應用架構與秘辛
[2020 .NET Conf] 企業Azure DevOps Service 實際應用架構與秘辛
 
快速入坑 Node.js - 0613 SITCON 雲林定期聚
快速入坑 Node.js - 0613 SITCON 雲林定期聚快速入坑 Node.js - 0613 SITCON 雲林定期聚
快速入坑 Node.js - 0613 SITCON 雲林定期聚
 
Docker open stack
Docker open stackDocker open stack
Docker open stack
 
Docker
DockerDocker
Docker
 
Azure Container Registry(preview)x Web App On Linux(preview)
Azure Container Registry(preview)x Web App On Linux(preview)Azure Container Registry(preview)x Web App On Linux(preview)
Azure Container Registry(preview)x Web App On Linux(preview)
 
專案啟動與設定
專案啟動與設定專案啟動與設定
專案啟動與設定
 
透過Nuget管理內部共用元件
透過Nuget管理內部共用元件透過Nuget管理內部共用元件
透過Nuget管理內部共用元件
 
Docker一期培训
Docker一期培训Docker一期培训
Docker一期培训
 
Azure Container Service 使用 DC / OS 管理 docker 容器
Azure Container Service 使用 DC / OS 管理 docker 容器Azure Container Service 使用 DC / OS 管理 docker 容器
Azure Container Service 使用 DC / OS 管理 docker 容器
 
当当网Docker应用实践
当当网Docker应用实践当当网Docker应用实践
当当网Docker应用实践
 
快速上手 Windows Containers 容器技術 (Docker Taipei)
快速上手 Windows Containers 容器技術 (Docker Taipei)快速上手 Windows Containers 容器技術 (Docker Taipei)
快速上手 Windows Containers 容器技術 (Docker Taipei)
 
WOT Cloud Computing Architect Summit
WOT Cloud Computing Architect SummitWOT Cloud Computing Architect Summit
WOT Cloud Computing Architect Summit
 
FHIR Server 安裝與使用
FHIR Server 安裝與使用FHIR Server 安裝與使用
FHIR Server 安裝與使用
 

More from Ching Yi Chan

JCConf2016 Jenkins Pipeline
JCConf2016 Jenkins PipelineJCConf2016 Jenkins Pipeline
JCConf2016 Jenkins PipelineChing Yi Chan
 
JCConf2015: groovy to gradle
 JCConf2015: groovy to gradle JCConf2015: groovy to gradle
JCConf2015: groovy to gradleChing Yi Chan
 
Java Build Tool course in 2011
Java Build Tool course in 2011Java Build Tool course in 2011
Java Build Tool course in 2011Ching Yi Chan
 
using Queue Server for batch processing
using Queue Server for batch processingusing Queue Server for batch processing
using Queue Server for batch processingChing Yi Chan
 
idea: talk about the Active Cache
idea: talk about the Active Cacheidea: talk about the Active Cache
idea: talk about the Active CacheChing Yi Chan
 
Java web programming
Java web programmingJava web programming
Java web programmingChing Yi Chan
 
Android NDK (JUG@TW 2011, Oct.)
Android NDK (JUG@TW 2011, Oct.)Android NDK (JUG@TW 2011, Oct.)
Android NDK (JUG@TW 2011, Oct.)Ching Yi Chan
 

More from Ching Yi Chan (12)

JCConf2016 Jenkins Pipeline
JCConf2016 Jenkins PipelineJCConf2016 Jenkins Pipeline
JCConf2016 Jenkins Pipeline
 
JCConf2015: groovy to gradle
 JCConf2015: groovy to gradle JCConf2015: groovy to gradle
JCConf2015: groovy to gradle
 
老舊web上雲端
老舊web上雲端老舊web上雲端
老舊web上雲端
 
Java Build Tool course in 2011
Java Build Tool course in 2011Java Build Tool course in 2011
Java Build Tool course in 2011
 
using Queue Server for batch processing
using Queue Server for batch processingusing Queue Server for batch processing
using Queue Server for batch processing
 
idea: talk about the Active Cache
idea: talk about the Active Cacheidea: talk about the Active Cache
idea: talk about the Active Cache
 
Talk about fabric
Talk about fabricTalk about fabric
Talk about fabric
 
Java web programming
Java web programmingJava web programming
Java web programming
 
Android NDK (JUG@TW 2011, Oct.)
Android NDK (JUG@TW 2011, Oct.)Android NDK (JUG@TW 2011, Oct.)
Android NDK (JUG@TW 2011, Oct.)
 
Unit Testing
Unit TestingUnit Testing
Unit Testing
 
OSGi Small Lab
OSGi Small LabOSGi Small Lab
OSGi Small Lab
 
Osgi Intro
Osgi IntroOsgi Intro
Osgi Intro
 

Linking error

  • 1. Develop With Docker Linking Error by qrtt1 HELP !!!
  • 3. Develop With Docker 最近在忙什麼 • 搞雲端、寫 Java、寫 Python、不想,但又得寫 C • ⾃自⼰己的 CDN ⾃自⼰己建 • ⾃自⼰己的雲端播放器⾃自⼰己做
  • 4. Develop With Docker 今天要講什麼 • ⾃自⼰己的雲端播放器⾃自⼰己建之⼀一⼩小部分 http://bit.ly/1ByJSVZ
  • 5. Develop With Docker 編譯是個苦工 Internet of Things Cross Compilation 潮 苦
  • 6. Develop With Docker • 同事A:裝不起來啊~~ • 同事B:怎麼弄的!? • 同事C:剛剛還可以的啊!!! • 同事X:幫我弄⼀一下 • 同事Z:Linux … 不熟哩~ 準備開發環境 悲 苦
  • 7. Develop With Docker 還有編譯腳本 • 年年向⿊黑道宣戰的男⼈人 • 這是 qrtt1 第 N 次向 AutoTools 宣戰 • 別說 AutoTools 了,連 Makefile 都寫得不忍直視 • 如何避免能⼒力有限形成的 Copy & Paste 世界奇觀: • Makefile.vendor[a-zA-z0-9]+
  • 8. Develop With Docker 助人為快樂之本 • [打算] 在 VM 環境好開發環境打包給同事使⽤用 • [vendor A] 要⽤用 fedora 8 裝他們的 toolchain • [vendor B] 要⽤用 ubuntu 裝他們的 toolchain • [vendor N] 要⽤用 xxxxxx 裝他們的 toolchain • 天殺的到底需要做幾個開發環境!?
  • 9. Develop With Docker 提案 • 建個 VM 環境,把所有東⻄西都安裝去上,再 export 發給需要開發的同事 • VM 開發環境的缺點 • 檔案較佔空間 • 執⾏行需要的資源較多 • 部分更新較不⽅方便
  • 10. Develop With Docker 各式格樣的組合 開發環境 For Vendor [a-zA-z0-9]+ 編譯腳本 for Vendor [a-zA-z0-9]+ X
  • 11. Develop With Docker 問題摘要 • 如何免除開發環境建置、維護的負擔 • toolchain 更新 • 相依 library 更新 • 如何維護各種 toolchain 的 Makefile
  • 12. Develop With Docker • 傳統的 Servers 管理 • 使⽤用⼯工⼈人智慧,⼀一⼀一建⽴立需要的 Server • 每次需耗損較多的⼯工⼈人時間,品質依⼯工⼈人⼼心情⽽而定 • 雲端⾵風格的 Servers 管理 • 使⽤用宣告式腳本,描述應該建⽴立的 Server • 使⽤用⼯工具依腳本建⽴立,品質相對穩定 向雲端借鏡
  • 13. Develop With Docker Infrastructure as Code • 基礎建設即為程式碼,例如雲端服務 AWS CloudFormation; DevOps ⼯工具: Ansible, Chef, Puppet • 程式碼 • ⽅方便透過版本控制系統管理 • 狀態容易 reproduce • 最終成果可拋式(Disposable)
  • 14. Develop With Docker • Vagrant: https://www.vagrantup.com/ • Provision ⼯工具:依腳本建⽴立出需要的 VM 環境 或 Docker Container • Docker: https://www.docker.com/ • Linux Container 管理⼯工具:依腳本建出需要的 Docker Image 開發環境 as Code
  • 15. Develop With Docker Docker • Docker 官網 
 https://www.docker.com/
 https://www.docker.com/tryit/ Docker 練習環境 • The Docker Ecosystem: An Introduction to Common Components
 http://bit.ly/1BE2WIc • Docker 101 - Intro to Docker 
 http://slidesha.re/1LxLOpD • 深⼊入浅出Docker(⼀一):Docker核⼼心技术预览
 http://bit.ly/1LxLRBN
  • 16. Develop With Docker Docker vs VM http://bit.ly/1A6ETAd 輕 盈
  • 17. Develop With Docker • build a image from the Dockerfile • run a container from the image • show the history of a image • commit changes of a container to a new image • stop, start, rm a container; rmi a image Docker Command
  • 18. Develop With Docker Dockerfile • Image 建⽴立腳本 FROM ubuntu:14.04.1 RUN apt-get update -y RUN apt-get install -y cmake RUN apt-get install -y vim RUN apt-get install -y wget tree ADD scripts/bashrc /.bashrc WORKDIR /data
  • 19. Develop With Docker Any Question Before Demonstration 
 Docker Basic Commands
  • 20. Develop With Docker [文件]製作開發環境 • 設想⼀一下⼀一般的⽂文件會看到什麼... • 啟動 docker for vendor A • 把 vendor A 的 toolchain.tgz 解到 /opt/vendorA/ • 開始編譯 XXX Library ⾄至 /opt/vendorA/XXX • 開始編譯 YYY Library ⾄至 /opt/vendorA/YYY • 把它 tar 起來,上傳⾄至 s3 後續使⽤用 WTF
  • 22. Develop With Docker Any Question Before Demonstration 
 Build Images For VENDORs
  • 23. Develop With Docker 開發環境 • 安裝 toolchain 與相關開發⼯工具 • 編譯相依 Libraries • prefix: /opt/vendor • 將上述需求整理成 script 與 Dockerfile • docker build -t acme/vendor . • 接著我們能這麼使⽤用 • docker run -ti acme/vendor /bin/bash …
  • 24. Develop With Docker 專案輔助腳本 • 進⼊入 docker container • docker-run.sh vendor • docker run -ti acme/vendor /bin/bash • 編譯專案 • docker-build.sh vendor • docker run -ti acme/vendor /bin/bash build.sh
  • 25. Develop With Docker CMake • Don’t Be Autofools • 模組化設計,需要 OOO 功能就引⽤用 OOO 模組 • 學習撰寫、改寫 find_package • 開發中的 library 常在⾮非系統預設路徑,適度的改 寫與客製化是必要的。http://bit.ly/1DmrtO3 • 範例:FindLibAO.cmake http://bit.ly/1DmtDgB
  • 26. Develop With Docker • CMake 2.6.0 後開始⽀支援 Cross compiling
 http://bit.ly/1DmsBRN • 將需要 Cross Compiling 設定的變數定義出來,並能 將設定獨⽴立在專屬的檔案內 Cross Compiling cmake -DCMAKE_TOOLCHAIN_FILE=toolchain_vendor.cmake . One vendor, One toolchain file
  • 27. Develop With Docker Any Question Before Demonstration 
 Build our Project
  • 28. Develop With Docker 組合的力量 Docker Image For Vendor [a-zA-z0-9]+ CMake Toolchain File for Vendor [a-zA-z0-9]+ X
  • 29. Develop With Docker • 如何免除開發環境建置、維護的負擔 • 如何優雅地寫出符合各種 toolchain 的 Makefile 複習一下 用 Docker,一人努力,多人享受 CMake + Find_Package + ToolchainFile