DEV Community

Cover image for Online-CV With Google-Cloud Run
πŸš€ Vu Dao πŸš€
πŸš€ Vu Dao πŸš€

Posted on

3 1

Online-CV With Google-Cloud Run

Inherit from the post pelican-resume with AWS EC2 this post shows how to create online-cv with gcloud-run

Source: https://github.com/vumdao/pelican-resume

1. Generate resume front-end output

docker run -v $PWD:/site vorakl/alpine-pelican pelican /site/content -o /site/output -s /site/pelicanconf.py
$ docker run -v $PWD:/site vorakl/alpine-pelican pelican /site/content -o /site/output -s /site/pelicanconf.py
WARNING: Feeds generated without SITEURL set properly may not be valid
WARNING: No valid files found in content for the active readers:
  | BaseReader (static)
  | HTMLReader (htm, html)
  | MarkdownReader (md, markdown, mkd, mdown)
  | RstReader (rst)
Done: Processed 0 articles, 0 drafts, 0 pages, 0 hidden pages and 0 draft pages in 0.09 seconds.
Enter fullscreen mode Exit fullscreen mode

2. Create nginx Dockerfile to create backend CV

# nginx state for serving content
FROM nginx:alpine
# Set working directory to nginx asset directory
WORKDIR /usr/share/nginx/html
# Remove default nginx static assets
RUN rm -rf ./*
COPY output .
# Containers run nginx with global directives and daemon off
EXPOSE 80
ENTRYPOINT ["nginx", "-g", "daemon off;"]
Enter fullscreen mode Exit fullscreen mode

3. Create cloud build yaml file

General Steps Of the build set

  • Build image
  • Push image to gcloud registry
  • gcloud deploy
steps: 
- name: 'gcr.io/cloud-builders/docker'
  args: [ 'build', '-t', 'gcr.io/$PROJECT_ID/myresume', '.' ]
- name: 'gcr.io/cloud-builders/docker'
  args: ['push', 'gcr.io/$PROJECT_ID/myresume']
- name: 'gcr.io/cloud-builders/gcloud'
  args:
  - 'run'
  - 'deploy'
  - 'cloudrunservice'
  - '--image'
  - 'gcr.io/$PROJECT_ID/myresume'
  - '--region'
  - 'asia-southeast1'
  - '--platform' 
  - 'managed'
  - '--allow-unauthenticated'  
images:
- 'gcr.io/$PROJECT_ID/myresume'
Enter fullscreen mode Exit fullscreen mode

4. Build and Deploy

Get familiar with gcloud-build and gcloud-run through

Remember to add permission to the cloud build

Alt Text

gcloud builds submit --config cloudbuild.yaml
Enter fullscreen mode Exit fullscreen mode

Note

Alt Text

Alt Text

Result

Step #2: Service [cloudrunservice] revision [cloudrunservice-00002-fin] has been deployed and is serving 100 percent of traffic.
Step #2: Service URL: https://cloudrunservice-ytz2j3pyjq-as.a.run.app
Enter fullscreen mode Exit fullscreen mode

Alt Text

Image of Datadog

Create and maintain end-to-end frontend tests

Learn best practices on creating frontend tests, testing on-premise apps, integrating tests into your CI/CD pipeline, and using Datadog’s testing tunnel.

Download The Guide

Top comments (0)

Image of Datadog

The Essential Toolkit for Front-end Developers

Take a user-centric approach to front-end monitoring that evolves alongside increasingly complex frameworks and single-page applications.

Get The Kit

πŸ‘‹ Kindness is contagious

Explore a sea of insights with this enlightening post, highly esteemed within the nurturing DEV Community. Coders of all stripes are invited to participate and contribute to our shared knowledge.

Expressing gratitude with a simple "thank you" can make a big impact. Leave your thanks in the comments!

On DEV, exchanging ideas smooths our way and strengthens our community bonds. Found this useful? A quick note of thanks to the author can mean a lot.

Okay