This is a personal portfolio website built with Next.js, Tailwind CSS, and TypeScript. It showcases projects, skills, and experience. The site is deployed on Google Cloud Run at https://kovendhan-portfolio-74857330583.us-central1.run.app.
git clone https://github.com/kovendhan5/portfolio-GCP.git
cd portfolio-GCP
npm install
npm run dev
Open http://localhost:3000 with your browser to see the result.This repository contains several helper scripts to make deployment and management easier:
deploy.bat
- Builds and deploys the application to Google Cloud Run (Windows)deploy.sh
- Builds and deploys the application to Google Cloud Run (Linux/Mac)manage-docker.bat
- Helps manage Docker containers (stop, clean up, and test locally)view-logs.bat
- Views logs from the running Docker containercheck-status.bat
- Checks status of the deployed Google Cloud Run serviceFor detailed deployment instructions, see the DEPLOYMENT.md file.
This project is successfully deployed on Google Cloud Run using Docker containers. You can view the live deployment at https://kovendhan-portfolio-74857330583.us-central1.run.app.
To deploy your own instance:
gcloud services enable artifactregistry.googleapis.com run.googleapis.com
# For Linux/Mac
chmod +x deploy.sh
./deploy.sh
# For Windows
deploy.bat
This repository includes several deployment scripts:
If you prefer to deploy manually:
You can test the Docker container locally before deploying to Google Cloud Run:
Build the Docker image:
docker build -t portfolio:latest .
Run the Docker container locally:
docker run -d --name portfolio-local -p 8080:8080 -e PORT=8080 portfolio:latest
Open http://localhost:8080 in your browser to test.
Or use the included helper script (Windows):
manage-docker.bat test
When done testing, stop and remove the container:
docker stop portfolio-local
docker rm portfolio-local
docker build -t portfolio:latest .
gcloud auth configure-docker [REGION]-docker.pkg.dev
gcloud artifacts repositories create kovendhan-portfolio --repository-format=docker --location=[REGION] --description="Repository for portfolio website"
docker tag portfolio:latest [REGION]-docker.pkg.dev/[PROJECT_ID]/kovendhan-portfolio/portfolio:latest
docker push [REGION]-docker.pkg.dev/[PROJECT_ID]/kovendhan-portfolio/portfolio:latest
gcloud iam service-accounts create portfolio-run-sa --display-name="Portfolio Cloud Run Service Account"
gcloud projects add-iam-policy-binding [PROJECT_ID] --member="serviceAccount:portfolio-run-sa@[PROJECT_ID].iam.gserviceaccount.com" --role="roles/run.invoker"
gcloud projects add-iam-policy-binding [PROJECT_ID] --member="serviceAccount:portfolio-run-sa@[PROJECT_ID].iam.gserviceaccount.com" --role="roles/artifactregistry.reader"
gcloud run services replace cloud-run-service.yaml --region=[REGION]
gcloud run services add-iam-policy-binding kovendhan-portfolio --member="allUsers" --role="roles/run.invoker" --region=[REGION]
The project uses Docker with a multi-stage build process:
You can also deploy to Vercel or Firebase Hosting. Refer to their respective documentation for deployment instructions.
The portfolio site relies on properly configured Nginx rules to handle static assets. Key configurations include:
Next.js Static Files: The _next/static
path requires special handling to serve CSS, JS, and other assets correctly
location ~* ^/static/(.*)$ {
alias /usr/share/nginx/html/_next/static/$1;
add_header Cache-Control "public, max-age=31536000, immutable";
}
Image Files: Image files are served either from the root or the /extra
directory
location ~ ^/[^/]+\.(jpg|jpeg|png|gif|ico|svg)$ {
root /usr/share/nginx/html;
try_files $uri /extra/$uri =404;
}
Directory Structure: The Docker build ensures that all required directories are created:
COPY --from=builder /app/out /usr/share/nginx/html
COPY --from=builder /app/public/extra /usr/share/nginx/html/extra
RUN mkdir -p /usr/share/nginx/html/_next
default.conf.template
manage-docker.bat
script to clean up any stale containersThis project is licensed under the MIT License.