The Challenge
As a Cloud Engineer, hosting a static portfolio on a basic web server wasn't enough. I needed to build a highly scalable, secure, and production-ready environment that practically demonstrates my skills in containerization and cloud hosting.
The system needed to:
- Scale to zero automatically to minimize cloud costs.
- Serve static HTML/CSS/JS via a lightweight Nginx container.
- Map to a custom domain with managed SSL certificates.
Architecture Overview
The solution uses a fully Google Cloud-native architecture with Docker containerization and a managed serverless runtime environment.
Fig 1. GCP Architecture — Serverless Portfolio Deployment
How It Works
Docker & Nginx
The HTML, CSS, and JS files are packaged into a lightweight Alpine Nginx Docker image to ensure consistent performance across environments.
GCP Console & CLI
Google Cloud Run service and Artifact Registry were provisioned securely using the GCP Console and the gcloud CLI.
Artifact Registry
The built Docker image is pushed to Google Artifact Registry, establishing a secure and version-controlled repository for the application.
Cloud Run & Domains
Cloud Run pulls the image and serves the site. GCP Domain Mapping connects my custom domain and provisions a free managed SSL certificate.
Implementation
The deployment is handled via the Google Cloud CLI. Here are the commands used to securely build the image and deploy the serverless Cloud Run environment:
-
1. Build and push the Docker image to Artifact Registry:
gcloud builds submit --tag europe-west4-docker.pkg.dev/[PROJECT_ID]/portfolio-repo/portfolio-image:latest .
-
2. Deploy the container to Cloud Run:
gcloud run deploy portfolio-website \
--image europe-west4-docker.pkg.dev/[PROJECT_ID]/portfolio-repo/portfolio-image:latest \
--region europe-west4 \
--allow-unauthenticated -
3. Map Custom Domain (Supported Region):
gcloud beta run domain-mappings create \
--service portfolio-website \
--domain [YOUR_CUSTOM_DOMAIN] \
--region europe-west4
Tech Stack
Future Improvements
To further align with modern DevOps practices, the next phases of this project involve fully automating the deployment lifecycle:
- Infrastructure as Code (Terraform): I plan to transition away from manual/CLI provisioning and define the entire GCP infrastructure (Artifact Registry, Cloud Run, IAM) declaratively using Terraform.
- CI/CD Pipeline (GitHub Actions): Setting up automated workflows so that every code push triggers a new Docker build and seamlessly deploys the latest version to Cloud Run without manual intervention.