Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
.git
.github
node_modules
.next
.env*
npm-debug.log*
README.md
.gitignore
.dockerignore
Dockerfile
docker-compose*
9 changes: 9 additions & 0 deletions .env.example
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# Authentication
GOOGLE_CLIENT_ID=your_google_client_id
GOOGLE_CLIENT_SECRET=your_google_client_secret
NEXTAUTH_URL=http://localhost:3000
NEXTAUTH_SECRET=your_nextauth_secret

# Analytics
POSTHOG_KEY=your_posthog_key
POSTHOG_HOST=your_posthog_host
55 changes: 55 additions & 0 deletions .github/workflows/docker-publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
name: Docker Image CI/CD

on:
push:
branches: [ "main" ]
tags: [ 'v*.*.*' ]
pull_request:
branches: [ "main" ]

env:
REGISTRY: ghcr.io
IMAGE_NAME: ${{ github.repository }}

jobs:
build:
runs-on: ubuntu-latest
permissions:
contents: read
packages: write

steps:
- name: Checkout repository
uses: actions/checkout@v4

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3

- name: Log into registry ${{ env.REGISTRY }}
if: github.event_name != 'pull_request'
uses: docker/login-action@v3
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Extract Docker metadata
id: meta
uses: docker/metadata-action@v5
with:
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
tags: |
type=ref,event=branch
type=ref,event=pr
type=semver,pattern={{version}}
type=semver,pattern={{major}}.{{minor}}

- name: Build and push Docker image
uses: docker/build-push-action@v5
with:
context: .
push: ${{ github.event_name != 'pull_request' }}
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
cache-from: type=gha
cache-to: type=gha,mode=max
81 changes: 39 additions & 42 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -1,42 +1,39 @@
name: Release

on:
push:
tags:
- 'v*'

jobs:
release:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0

- name: Setup Node.js
uses: actions/setup-node@v3
with:
node-version: '18'
cache: 'npm'

- name: Install dependencies
run: npm ci

- name: Generate changelog
run: |
npm run changelog
git config --local user.email "[email protected]"
git config --local user.name "GitHub Action"
git add CHANGELOG.md
git commit -m "docs: update changelog for ${{ github.ref_name }}" || echo "No changes to commit"

- name: Create Release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ github.ref }}
release_name: Release ${{ github.ref }}
body_path: .github/RELEASE_BODY.md
draft: false
prerelease: false
name: Release

on:
push:
branches: [main]

permissions:
contents: write
pull-requests: write

jobs:
release:
name: Release
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: "lts/*"
cache: 'npm'

- name: Install dependencies
run: npm ci

- name: Create Release
id: changesets
uses: changesets/action@v1
with:
version: npm run version
commit: "chore: version packages"
title: "chore: version packages"
publish: npm run changelog
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,8 @@ yarn-error.log*

# local env files
.env*.local
.env.production
.env.development

# vercel
.vercel
Expand Down
62 changes: 62 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
# Stage 1: Development dependencies
FROM node:18-alpine AS deps
WORKDIR /app

# Install dependencies needed for build
RUN apk add --no-cache libc6-compat

# Copy package files
COPY package.json package-lock.json ./

# Install dependencies
RUN npm ci

# Stage 2: Builder
FROM node:18-alpine AS builder
WORKDIR /app

# Copy dependencies from deps stage
COPY --from=deps /app/node_modules ./node_modules
COPY . .

# Set environment variables for build
ENV NEXT_TELEMETRY_DISABLED 1
ENV NODE_ENV production

# Build application
RUN npm run build

# Stage 3: Production image
FROM node:18-alpine AS runner
WORKDIR /app

# Set environment variables
ENV NODE_ENV production
ENV NEXT_TELEMETRY_DISABLED 1

# Create non-root user
RUN addgroup --system --gid 1001 nodejs
RUN adduser --system --uid 1001 nextjs

# Set proper permissions
RUN mkdir .next
RUN chown nextjs:nodejs .next

# Copy only necessary files
COPY --from=builder --chown=nextjs:nodejs /app/public ./public
COPY --from=builder --chown=nextjs:nodejs /app/.next/standalone ./
COPY --from=builder --chown=nextjs:nodejs /app/.next/static ./.next/static
COPY --from=builder /app/data ./data

# Switch to non-root user
USER nextjs

# Expose port
EXPOSE 3000

# Set hostname
ENV PORT 3000
ENV HOSTNAME "0.0.0.0"

# Start the application
CMD ["node", "server.js"]
2 changes: 1 addition & 1 deletion app/auth/signin/page.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
"use client";

// import { signIn } from "next-auth/react";
import SignInButton from "@/components/Sign-in";
import SignInButton from "@/components/SignIn";

export default function SignIn() {
return (
Expand Down
20 changes: 20 additions & 0 deletions app/components/structured-data.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
export function generateStructuredData(pageType: string) {
switch (pageType) {
case 'website':
return {
'@context': 'https://schema.org',
'@type': 'WebSite',
name: 'COC VJTI',
description: 'Explore tech communities and resources for VJTI students',
url: 'https://coc-landing.vercel.app',
};
case 'organization':
return {
'@context': 'https://schema.org',
'@type': 'EducationalOrganization',
name: 'COC VJTI',
url: 'https://coc-landing.vercel.app',
logo: 'https://coc-landing.vercel.app/logo.png',
};
}
}
44 changes: 42 additions & 2 deletions app/layout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,48 @@ const montserrat = Montserrat({
});

export const metadata: Metadata = {
title: "Create Next App",
description: "Generated by create next app",
metadataBase: new URL('https://coc-landing.vercel.app'),
title: {
default: "VJTI Resources & Communities",
template: "%s | VJTI Resources"
},
description: "Access curated educational resources, join tech communities, and connect with VJTI's developer ecosystem. Features AI, Web Dev, CP, and academic materials.",
keywords: ["VJTI", "education", "resources", "developer communities", "engineering", "tech clubs", "Mumbai","AI","Web Dev","CP","academic materials","coc","coding"],
authors: [{ name: "VJTI Resources Team" }],
openGraph: {
type: "website",
locale: "en_IN",
url: "https://coc-landing.vercel.app",
siteName: "VJTI Resources",
images: [{
url: "/coc_vjti.jpeg",
width: 1200,
height: 630,
alt: "VJTI Resources & Communities Logo"
}],
},
twitter: {
card: "summary_large_image",
site: "@vjti_resources",
images: "/coc_vjti.jpeg",
},
icons: {
icon: "/coc_vjti.jpeg",
},
robots: {
index: true,
follow: true,
googleBot: {
index: true,
follow: true,
"max-video-preview": -1,
"max-image-preview": "large",
"max-snippet": -1,
},
},
verification: {
google: "your-google-verification-code",
},
};

export default function RootLayout({
Expand Down
Loading
Loading