LoginSignup
0
2

More than 1 year has passed since last update.

.gitpodの使い方

Posted at

gitpodに関する情報が少ないと感じるので、備忘録程度に書きます。

gitpod.ymlファイルの作成

gp init

gitpodはgitpod.ymlファイルを作成することにより、開発環境を維持することが出来る。
書き方はdocker-compose.ymlと同じ記述方式で、ドキュメントルートにてコマンドを走らせる。
※-iオプションを付けるとインタラクティブモードで作成してくれるらしい

gitpod.ymlのオプション

使いそうなものだけ、必要そうなものだけをピックアップしました。
その他の細かい設定はhttps://www.gitpod.io/docs/references/gitpod-yml

github
デフォルトでは以下の設定がされている様子。

// EXAMPLE

github:
  prebuilds:
    master: true
    branches: true
    pullRequests: true
    pullRequestsFromForks: true
    addCheck: false
    addComment: false
    addBadge: true

prebuilds.addComment

このオプションをtrueにするとgithubでプルリクエストしたときの確認をgitpodで開くことが出来らしい。

image
ワークスペースに使用するDockerイメージのカスタマイズが出来るそう。
https://www.gitpod.io/docs/config-docker

// EXAMPLE

// With a public image
image: ubuntu:latest

// With a custom image
image:
  file: .gitpod.Dockerfile

// With an optional context
image:
  file: .gitpod.Dockerfile
  context: ./docker-content

ports

ポートの設定

// EXAMPLE

ports:
  - port: 3000
    onOpen: open-preview
  - port: 10000
    onOpen: ignore

tasks
プロジェクトの準備および構築する方法、プロジェクトの開発サーバーを起動する方法を定義出来る。
https://www.gitpod.io/docs/config-start-tasks

// EXAMPLE
tasks:
  - before: sh ./scripts/setup.sh
    init: npm install
    command: npm run dev
  - name: Database
    init: sh ./scripts/seed-database.sh
    command: npm start-db
    env:
      DB_HOST: localhost:3306
      DB_USER: readOnlyUser

・before initの前に実行するシェルコマンドとメインコマンド(開始の度に実行される)
・command beforeやinitの後に実行するコマンド
・env   環境変数
・init beforeとmainコマンドの間で実行される
・name taskの名前

vscode
VScodeの拡張が出来る。
拡張機能の識別子は常に$ {publisher}。$ {name}だそう。

vscode:
  extensions:
    - svelte.svelte-vscode
    - bradlc.vscode-tailwindcss

結論
まとめたけど、まだよくわからん。

0
2
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
2