1
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

How to firebase deploy

Posted at

概要

  • Google CloudのFirebaseにreactなどのSAPを最速でdeployする方法。
  • npmを使用している想定の手順書。

手順

  1. Firebaseアカウントの登録
    1. Firebase にアクセスし、「使ってみる」または「コンソールに移動」をクリック。
    2. Googleアカウントでログインします。アカウントがない場合は新規作成する。
  2. Firebase CLIのインストールと設定
    1. npm install -g firebase-tools を実行してFirebase CLIをインストールする。
    2. firebase login を実行してFirebaseアカウントにログインする。
    3. リンクを開くか選択(y/n)が出てくるので、「y」を選択してリンクを開く。
    4. ログインしたいアカウントを選択し、ログイン成功画面まで持っていく。
  3. Firebaseの初期設定(project作成から)
    1. firebase init
    2. ◯ Hosting: Configure files for Firebase Hosting and (optionally) set up GitHub Action deploys を選択
    3. Create a new project を選択
      1. 手動でproject作成している場合はUse an existing projectを選択
    4. ? Please specify a unique project id (warning: cannot be modified afterward) [6-30 characters]: が表示されるのでproject名を入力する。
      1. project名は一意である必要があるので、重複している場合は、適当な文字列を入れる
    5. ? What would you like to call your project? (defaults to your project ID) () が表示されるので、表示名を入力する。
      1. これは表示名なので一意である必要はない。
    6. ? What do you want to use as your public directory? (public) が表示されるのでbuild を入力する。
      1. viteの場合などはdist が適切な場合もある。buildしたindex.htmlがあるdir名を入れる箇所
    7. ? Configure as a single-page app (rewrite all urls to /index.html)? (y/N) y を入力。
      1. SAPかどうかを聞かれている
    8. ? Set up automatic builds and deploys with GitHub? (y/N) nを入力
      1. githubに自動デブロイを設定する場合はyを選択
    9. ? File build/index.html already exists. Overwrite? (y/N) yを入力
  4. buildとdeploy
    1. npm run build でbuildファイルを作成
    2. firebase deploy でdeployを実行
  5. 補足
    1. 上記は初回手順である
    2. 2回目以降は以下でdeploy可能
      1. firebase login (ログイン情報がある場合は不要)
      2. npm run build
      3. firebase deploy
1
0
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
1
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?