Last active
February 14, 2025 00:19
-
-
Save TheRealFlyingCoder/80556cb29463ae3d2b424f61e8e5830d to your computer and use it in GitHub Desktop.
Revisions
-
TheRealFlyingCoder revised this gist
Jan 18, 2023 . 3 changed files with 3 additions and 7 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -7,7 +7,7 @@ Step 2: Allow all traffic in the /triggers tab Cloud Build: Step 1: Set up a Cloud Build trigger on your repo Step 2: Point the configuration to "cloud build configuration file" at the root of your project Step 3: Add the following to the substitution variables (so you can keep it safe): _SERVICE_NAME: your service ID from Cloud run above _DEPLOY_REGION: where you want it deployed to This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,7 +1,5 @@ # # base node image FROM node:16-bullseye-slim as base # # Build the dev image FROM base as build @@ -16,15 +14,15 @@ FROM base as production-deps RUN mkdir /app/ WORKDIR /app/ COPY --from=build /app/node_modules /app/node_modules ADD package.json package-lock.json /app/ RUN npm prune --production # Pull out the build files and do a production install FROM base ENV NODE_ENV=production RUN mkdir /app/ WORKDIR /app/ ADD package.json package-lock.json /app/ COPY --from=build /app/public /app/public COPY --from=build /app/server /app/server COPY --from=production-deps /app/node_modules /app/node_modules This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -7,8 +7,6 @@ steps: "build", "-t", "gcr.io/$PROJECT_ID/$_SERVICE_NAME:$COMMIT_SHA", "." ] - name: 'gcr.io/cloud-builders/docker' -
TheRealFlyingCoder renamed this gist
Sep 27, 2021 . 1 changed file with 0 additions and 0 deletions.There are no files selected for viewing
File renamed without changes. -
TheRealFlyingCoder created this gist
Sep 27, 2021 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,31 @@ # # base node image FROM node:16-bullseye-slim as base ARG REMIX_TOKEN ENV REMIX_TOKEN=${REMIX_TOKEN} # # Build the dev image FROM base as build RUN mkdir /app/ WORKDIR /app/ COPY . /app RUN npm install RUN npm run build # # Get the production modules FROM base as production-deps RUN mkdir /app/ WORKDIR /app/ COPY --from=build /app/node_modules /app/node_modules ADD package.json package-lock.json .npmrc /app/ RUN npm prune --production # Pull out the build files and do a production install FROM base ENV NODE_ENV=production RUN mkdir /app/ WORKDIR /app/ ADD package.json package-lock.json .npmrc /app/ COPY --from=build /app/public /app/public COPY --from=build /app/server /app/server COPY --from=production-deps /app/node_modules /app/node_modules CMD ["node", "server/index.js"] This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,20 @@ So you want to set up remix in cloud run huh? It's pretty simple but i'm going to assume you can figure out most of the GCP UI on your own. Cloud Run: Step 1: Create a new service and take note of the service ID Step 2: Allow all traffic in the /triggers tab Cloud Build: Step 1: Set up a Cloud Build trigger on your repo Step 2: Point the configuration to "cloud build configuration file" at the root of your project Step 3: Add _REMIX_TOKEN to the substitution variables (so you can keep it safe) you should also have: _SERVICE_NAME: your service ID from Cloud run above _DEPLOY_REGION: where you want it deployed to Repo: Step 1: Add the cloudbuild.yaml to your project root Step 2: Add the Dockerfile to your project root Note: The Dockerfile will change depending on which Remix version you are using so try to understand what it does so you can make project specific changes Step 3: Update your firebase.json to rewrite all routes to the cloud build service Step 4: Push up the changes and watch to see cloud build successfully ran. This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,21 @@ steps: # Build the container image - name: "gcr.io/cloud-builders/docker" args: [ "build", "-t", "gcr.io/$PROJECT_ID/$_SERVICE_NAME:$COMMIT_SHA", "--build-arg", "REMIX_TOKEN=$_REMIX_TOKEN", "." ] - name: 'gcr.io/cloud-builders/docker' args: ['push', 'gcr.io/$PROJECT_ID/$_SERVICE_NAME:$COMMIT_SHA'] - name: 'gcr.io/google.com/cloudsdktool/cloud-sdk' entrypoint: gcloud args: ['run', 'deploy', '$_SERVICE_NAME', '--image', 'gcr.io/$PROJECT_ID/$_SERVICE_NAME:$COMMIT_SHA', '--region', '$_DEPLOY_REGION'] images: [ "gcr.io/$PROJECT_ID/$_SERVICE_NAME:$COMMIT_SHA" ] This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,19 @@ "hosting": [ { "site": "my-site", "public": "public", "ignore": [ "firebase.json", "**/.*", "**/node_modules/**" ], "rewrites": [ { "source": "**", "run": { "serviceId": "my-service-id" } } ] } ],