Code Monkey home page Code Monkey logo

firebase-dev-day-2019's Introduction

firebase-dev-day-2019

Firebase Dev Day 2019 - Building dynamic website by Firebase Hosting x Cloud Run

Docker Command

Build

docker build -t asia.gcr.io/gear2019v2/firebase-dev-day-2019:latest .

Run

docker run -p 8080:8080 asia.gcr.io/gear2019v2/firebase-dev-day-2019:latest

Run with local source

docker run --mount type=bind,source="$(pwd)",target=/var/www/html -p 8080:8080 asia.gcr.io/gear2019v2/firebase-dev-day-2019:latest

GCP Cloud Run Command

gcloud builds submit --tag asia.gcr.io/gear2019v2/firebase-dev-day-2019:latest

gcloud beta run deploy --image asia.gcr.io/gear2019v2/firebase-dev-day-2019:latest --platform managed

Demo

PHP App on container

  1. Dev PHP App

  2. Build Docker (PHP + Apache)

Cloud Run

  1. Build Docker image locally.

    docker build -t asia.gcr.io/gear2019v2/firebase-dev-day-2019:latest .
  2. Optional - Config gcloud. https://cloud.google.com/sdk/docs/ Configure Docker to use Google Cloud Platform

    gcloud auth configure-docker
  3. Push the image to GCR.

    docker push asia.gcr.io/gear2019v2/firebase-dev-day-2019:latest
  4. Deploy to Cloud Run.

    gcloud beta run deploy gear2019v2-firebase-dev-day-2019 \
        --quiet \
        --image asia.gcr.io/gear2019v2/firebase-dev-day-2019:latest \
        --project gear2019v2 \
        --region asia-northeast1 \
        --platform managed \
        --allow-unauthenticated

Firebase Hosting

  1. Create a new site on console, name fir-dev-day-2019

  2. Set up deploy targets

    firebase target:apply hosting gear2019v2 gear2019v2
    firebase target:apply hosting fir-dev-day-2019 fir-dev-day-2019
  3. Add rewrites config

    {
        ...
        "hosting": [
            {},
            ...
            {
                "target": "fir-dev-day-2019",
                "public": "fir-dev-day-2019/public",
                "ignore": [ "firebase.json", "**/.*", "**/node_modules/**" ],
                "rewrites": [
                    {
                        "source": "**",
                        "run": {
                            "serviceId": "gear2019v2-firebase-dev-day-2019",
                            "region": "asia-northeast1"
                        }
                    }
                ]
            },
            ...
        ]
    }

    To listing Firebase project

    firebase projects:list
  4. Deploy

    firebase deploy --only hosting:fir-dev-day-2019

References

https://cloud.google.com/run/docs/quickstarts/build-and-deploy

https://cloud.google.com/container-registry/docs/pushing-and-pulling

https://cloud.google.com/sdk/gcloud/reference/beta/run/deploy

firebase-dev-day-2019's People

Contributors

puuga avatar

Watchers

James Cloos avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.