From c6a2a1e93179675c50743014933b74f8733c667d Mon Sep 17 00:00:00 2001 From: jackyzha0 Date: Mon, 25 May 2020 21:55:50 -0700 Subject: add more build commands and added prod backend url --- Makefile | 13 ++++++++++--- README.md | 8 +++++++- frontend/src/helpers/httpHelper.js | 4 +++- 3 files changed, 20 insertions(+), 5 deletions(-) diff --git a/Makefile b/Makefile index 472fb7c..532a735 100644 --- a/Makefile +++ b/Makefile @@ -6,12 +6,19 @@ docker-build: docker build -t jzhao2k19/ctrl-v:latest ./backend docker-run: docker run -p 8080:8080 jzhao2k19/ctrl-v:latest -docker-all: docker-build docker-run +docker-all: + docker-build docker-run +gcr: + docker tag jzhao2k19/ctrl-v:latest gcr.io/ctrl-v-278404/backend && docker push gcr.io/ctrl-v-278404/backend docker-push: docker push jzhao2k19/ctrl-v:latest fe-run: cd frontend && yarn start fe-build: cd frontend && yarn build -all: - make -j 2 run fe-run \ No newline at end of file +fe-deploy: + fe-build && cd frontend && firebase deploy +dev: + make -j 2 run fe-run +deploy: + docker-build && gcr && fe-deploy \ No newline at end of file diff --git a/README.md b/README.md index 29d90e6..3abd0e6 100644 --- a/README.md +++ b/README.md @@ -8,6 +8,8 @@ Frontend is in React and backend is in Go. ![View Paste (different theme)](https://user-images.githubusercontent.com/23178940/82101261-ea7a6b00-96c0-11ea-9cf1-9b81883ab9f5.png) ## developing +when doing local backend development, make sure you change the backend address to be localhost. You can find this on Line 4 of `frontend/src/helpers/httpHelper.js` + #### Common `make all` — starts React development server on `:3000` and backend on `:8080` @@ -16,6 +18,8 @@ Frontend is in React and backend is in Go. `make fe-build` — builds development release of frontend in `frontend/build` +`make firebase` — deploys dev release of frontend to Firebase. Live at `ctrl-v.app` + #### Backend `make run` — starts backend on `:8080` @@ -27,4 +31,6 @@ Frontend is in React and backend is in Go. `make docker-all` — builds and runs built Docker image on `:8080` -`make docker-push` — pushes build Docker image to Dockerhub \ No newline at end of file +`make docker-push` — pushes build Docker image to Dockerhub + +`make gcr` — tags and pushes iamge to Google Container Registry for Cloud Run. Changes are live on `api.ctrl-v.app` \ No newline at end of file diff --git a/frontend/src/helpers/httpHelper.js b/frontend/src/helpers/httpHelper.js index 28704f5..0c7c295 100644 --- a/frontend/src/helpers/httpHelper.js +++ b/frontend/src/helpers/httpHelper.js @@ -1,6 +1,8 @@ import axios from 'axios'; -const base = `http://localhost:8080/api` +// uncomment for local dev +// const base = `http://localhost:8080/api` +const base = `https://api.ctrl-v.app/api` export function FetchPaste(hash) { const serverURL = `${base}/${hash}` -- cgit v1.2.3