Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
DockerでAngular開発
Search
Sponsored
·
Your Podcast. Everywhere. Effortlessly.
Share. Educate. Inspire. Entertain. You do you. We'll handle the rest.
→
rayyyy
January 11, 2019
0
460
DockerでAngular開発
rayyyy
January 11, 2019
Tweet
Share
Featured
See All Featured
How to Ace a Technical Interview
jacobian
281
24k
Impact Scores and Hybrid Strategies: The future of link building
tamaranovitovic
0
240
Why Mistakes Are the Best Teachers: Turning Failure into a Pathway for Growth
auna
0
96
How To Speak Unicorn (iThemes Webinar)
marktimemedia
1
410
Large-scale JavaScript Application Architecture
addyosmani
515
110k
Measuring & Analyzing Core Web Vitals
bluesmoon
9
790
Pawsitive SEO: Lessons from My Dog (and Many Mistakes) on Thriving as a Consultant in the Age of AI
davidcarrasco
0
93
Discover your Explorer Soul
emna__ayadi
2
1.1k
Keith and Marios Guide to Fast Websites
keithpitt
413
23k
The Illustrated Children's Guide to Kubernetes
chrisshort
51
52k
Code Reviewing Like a Champion
maltzj
528
40k
Ruling the World: When Life Gets Gamed
codingconduct
0
180
Transcript
DockerでAngular開発 エイチーム新卒2年 ナバロ ライ
ココに立つまで ・いろいろな勉強会に興味あり ・LTも挑戦したい! ・学生の頃、Angular 2をめちゃくちゃ触った (現在のバージョン 7)
Angularをインストールするか
・・・
ローカルを汚したくないな
Docker環境でやろう
Docker環境構築得意な人〜✋
は〜い✋
成果物 GitHub https://github.com/rayyyy/angular-docker
Docker環境 要件 ・Angularや必要なコマンドはコンテナ内で実行 ・動作確認はブラウザでできるように ・コンテナ内のファイルはローカルのエディタで編集
Docker環境構築の流れ 1. Dockerfileの作成 2. docker-compose.ymlの作成 3. 便利なMakefile作成
Dockerfile 作成 FROM node:11.6.0 as build_env RUN npm install -g @angular/cli
WORKDIR /root/my-app # コンテナ内のファイルはローカルのエディタで編集するために # ローカルのファイルをコンテナ内のワーキングスペースにコピー COPY . /root/my-app/
docker-compose.yml 作成 version: '3.7' services: web_dev: build: context: . target: build_env
tty: true # 処理が終わってもコンテナが終了しないように ports: - "4200:4200" # ローカルでの動作確認用 volumes: - .:/root/my-app # コンテナのフォルダをローカルにマウントする
Dockerfile 作成 $ docker-compose up -d $ docker-compose exec web_dev bash
Makefile
all: rm build up ps build: docker-compose build --no-cache up:
docker-compose up -d --build exec: docker-compose exec web_dev bash Makefile 作成 ps: docker ps -a && echo "\n" docker-compose ps rm: docker-compose stop docker-compose rm -f
$ make up イコール $ docker-compose up -d
Angular環境完成したのでプロジェクト作成 $ docker-compose up -d or make up $ docker-compose
exec web_dev bash or make exec root@71ca9dfb0e43:~/my-app# ng new myApp root@71ca9dfb0e43:~/my-app# cd myApp/ root@71ca9dfb0e43:~/my-app/myApp# ng serve --host 0.0.0.0 http://localhost:4200/
None
Netlifyでデプロイ&ホスティング 詳しくは書きませんが GitHubと連携するとすぐデプロイできます。 初心者なのでこれぐらいしかまだわかっていませんが 便利そうです
ご清聴ありがとうございました