From db9e6d60407f434ce778be8c681fef3a773dbf16 Mon Sep 17 00:00:00 2001 From: smit95tpatel Date: Wed, 4 May 2022 14:45:23 +0530 Subject: [PATCH] feat: checking env variables --- .github/workflows/ci.yml | 6 +----- Dockerfile.base | 3 ++- react-frontend/package.json | 1 + react-frontend/src/components/App.jsx | 2 +- 4 files changed, 5 insertions(+), 7 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 4b5dda13..e1e9d7d8 100755 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -49,7 +49,6 @@ jobs: file: ./Dockerfile.base build-args: | GIT_COMMIT_HASH=${{ github.sha }} - GIT_TOKEN=${{ secrets.GIT_TOKEN }} GITHUB_ACCESS_TOKEN=${{ secrets.CI_BOT_TOKEN }} cache-from: type=local,src=/tmp/.buildx-cache cache-to: type=local,dest=/tmp/.buildx-cache @@ -63,10 +62,7 @@ jobs: tags: razorpay/statping:service_${{ github.sha }} push: true file: ./Dockerfile - build-args: | - GIT_COMMIT_HASH=${{ github.sha }} - GIT_TOKEN=${{ secrets.GIT_TOKEN }} - GITHUB_ACCESS_TOKEN: ${{ secrets.CI_BOT_TOKEN }} + build-args: GIT_COMMIT_HASH=${{ github.sha }} cache-from: type=local,src=/tmp/.buildx-cache cache-to: type=local,dest=/tmp/.buildx-cache env: diff --git a/Dockerfile.base b/Dockerfile.base index 2869241c..eb70c5b4 100644 --- a/Dockerfile.base +++ b/Dockerfile.base @@ -20,7 +20,8 @@ COPY ./react-frontend/yarn.lock . COPY ./react-frontend/.npmrc . RUN yarn install --pure-lockfile --network-timeout 1000000 COPY ./react-frontend/ . -RUN yarn build && yarn cache clean +COPY ./react-frontend/.env.production . +RUN yarn build:production && yarn cache clean # Statping Golang BACKEND building from source # Creates "/go/bin/statping" and "/usr/local/bin/sass" for copying diff --git a/react-frontend/package.json b/react-frontend/package.json index 0157efe8..1914b3d5 100644 --- a/react-frontend/package.json +++ b/react-frontend/package.json @@ -5,6 +5,7 @@ "scripts": { "start": "react-scripts start", "build": "rm -rf build && GENERATE_SOURCEMAP=false react-scripts build", + "build:production": "rm -rf build && GENERATE_SOURCEMAP=false REACT_APP_ENV=production react-scripts build", "test": "react-scripts test", "eject": "react-scripts eject" }, diff --git a/react-frontend/src/components/App.jsx b/react-frontend/src/components/App.jsx index 430c5939..a77a689b 100644 --- a/react-frontend/src/components/App.jsx +++ b/react-frontend/src/components/App.jsx @@ -7,7 +7,7 @@ import Navigation from "./Navbar"; import { initLumberjack } from "../utils/trackers"; const App = () => { - console.log(`Application running on ${process.env.NODE_ENV} mode.`); + console.log(`Application running on ${JSON.stringify(process.env)} mode.`); useEffect(() => { initLumberjack(); }, [])