Tech/Side Project

Firebase에 웹앱 호스팅하기

토궁 2022. 10. 10. 12:57
728x90
반응형

Firebase는 사이드 프로젝트를 올리기 가장 적합한 PaaS 서비스라고 생각한다.

웹호스팅, 데이터베이스, 인증 이 모든게 일정량이 모두 무료이기 때문이다.

 

일단 호스팅부터 deploy 해보기로..

 

firebase cli를 설치하고

> npm install -g firebase-tools

firebase init hosting

 

아래와 같이 cli가 알아서 셋팅해준다.

 

➜  **** git:(main) firebase init hosting

     ######## #### ########  ######## ########     ###     ######  ########
     ##        ##  ##     ## ##       ##     ##  ##   ##  ##       ##
     ######    ##  ########  ######   ########  #########  ######  ######
     ##        ##  ##    ##  ##       ##     ## ##     ##       ## ##
     ##       #### ##     ## ######## ########  ##     ##  ######  ########

You're about to initialize a Firebase project in this directory:

  /Users/****


=== Project Setup

First, let's associate this project directory with a Firebase project.
You can create multiple project aliases by running firebase use --add,
but for now we'll just set up a default project.

? Please select an option: Use an existing project
? Select a default Firebase project for this directory: (****)
i  Using project *****-***** (*****)

=== Hosting Setup

Your public directory is the folder (relative to your project directory) that
will contain Hosting assets to be uploaded with firebase deploy. If you
have a build process for your assets, use your build's output directory.

? What do you want to use as your public directory? dist
? Configure as a single-page app (rewrite all urls to /index.html)? Yes
? Set up automatic builds and deploys with GitHub? Yes
? File dist/index.html already exists. Overwrite? No
i  Skipping write of dist/index.html

i  Detected a .git folder at /Users/****
i  Authorizing with GitHub to upload your service account to a GitHub repository's secrets store.

Visit this URL on this device to log in:

Waiting for authentication...

✔  Success! Logged into GitHub as ~~~

? For which GitHub repository would you like to set up a GitHub workflow? (format: user/repository) ********/****

✔  Created service account github-action-548702641 with Firebase Hosting admin permissions.
✔  Uploaded service account JSON to GitHub as secret *********************.
i  You can manage your secrets at https://github.com/**********/****/settings/secrets.

? Set up the workflow to run a build script before every deploy? Yes
? What script should be run before every deploy? yarn run build

✔  Created workflow file /Users/bag-yeongjun/Documents/project/****/.github/workflows/firebase-hosting-pull-request.yml
? Set up automatic deployment to your site's live channel when a PR is merged? Yes
? What is the name of the GitHub branch associated with your site's live channel? main

✔  Created workflow file /User/****/.github/workflows/firebase-hosting-merge.yml

i  Action required: Visit this URL to revoke authorization for the Firebase CLI GitHub OAuth App:
i  Action required: Push any new workflow file(s) to your repo

i  Writing configuration info to firebase.json...
i  Writing project information to .firebaserc...

이후 firebase deploy 명령어만 실행하면 바로 배포 끝.

이제 다른 서비스도 조합해서 사이드 프로젝트를 해봐야 겠다.

반응형