Skip to content

Commit

Permalink
feat: v1.0.0 (#1)
Browse files Browse the repository at this point in the history
  • Loading branch information
sgoudham committed Aug 13, 2023
1 parent 005e6ee commit e02fe18
Show file tree
Hide file tree
Showing 63 changed files with 6,701 additions and 3,192 deletions.
4 changes: 3 additions & 1 deletion .dockerignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,6 @@ node_modules
.husky
.direnv
flake.lock
flake.nix
flake.nix
*.md
*.env.*
49 changes: 49 additions & 0 deletions .github/workflows/preview.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
name: Publish Preview Image

on:
workflow_dispatch:
push:
branches: [main, "refactor/app-router"]
paths:
- "app/**"
- "next.config.js"
- "package.json"
- "tailwind.config.js"
- "Dockerfile"

jobs:
push_to_registry:
name: Push Image to Docker Hub
runs-on: ubuntu-latest
steps:
- name: Checkout Repository
uses: actions/checkout@v3

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

- name: Log Into Docker Hub
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_TOKEN }}

- name: Set Short SHA
id: short_sha
run: echo "short_sha=$(git rev-parse --short HEAD)" >> $GITHUB_OUTPUT

- name: Build/Push Image
uses: docker/build-push-action@v4
with:
context: .
push: true
build-args: |
NEXT_PUBLIC_IS_PREVIEW=1
NEXT_PUBLIC_BUILD_SHA=${{ steps.short_sha.outputs.short_sha }}
NEXT_PUBLIC_BUILD_ID=${{ github.run_id }}
NEXT_PUBLIC_BUILD_NUM=${{ github.run_number }}
secrets: |
REPOS_READ_ONLY=${{ secrets.REPOS_READ_ONLY }}
tags: ${{ secrets.DOCKER_USERNAME }}/website:preview
cache-from: type=gha
cache-to: type=gha,mode=max
33 changes: 0 additions & 33 deletions .github/workflows/publish.yml

This file was deleted.

40 changes: 40 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
name: Publish Production Image

on:
push:
tags:
- "*"

jobs:
push_to_registry:
name: Push Image to Docker Hub
runs-on: ubuntu-latest
steps:
- name: Checkout Repository
uses: actions/checkout@v3

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

- name: Log Into Docker Hub
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_TOKEN }}

- name: Set Short SHA
id: short_sha
run: echo "short_sha=$(git rev-parse --short HEAD)" >> $GITHUB_OUTPUT

- name: Build/Push Image
uses: docker/build-push-action@v4
with:
context: .
push: true
build-args:
NEXT_PUBLIC_BUILD_SHA=${{ steps.short_sha.outputs.short_sha }}
NEXT_PUBLIC_BUILD_ID=${{ github.run_id }}
NEXT_PUBLIC_BUILD_NUM=${{ github.run_number }}
secrets: |
REPOS_READ_ONLY=${{ secrets.REPOS_READ_ONLY }}
tags: ${{ secrets.DOCKER_USERNAME }}/website:${{ github.ref_name }}
11 changes: 10 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -37,4 +37,13 @@ next-env.d.ts

# nix
.direnv/
.envrc
.envrc
.env*

# yarn
.yarn/*
!.yarn/releases
!.yarn/plugins
!.yarn/sdks
!.yarn/versions
.pnp.*
874 changes: 874 additions & 0 deletions .yarn/releases/yarn-3.6.1.cjs

Large diffs are not rendered by default.

3 changes: 3 additions & 0 deletions .yarnrc.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
nodeLinker: node-modules

yarnPath: .yarn/releases/yarn-3.6.1.cjs
57 changes: 40 additions & 17 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,35 +1,58 @@
# Installing Dependencies
FROM node:18-alpine AS deps
# Dependencies Image
FROM node:20-alpine AS deps
RUN apk add --no-cache libc6-compat
WORKDIR /app
COPY package.json yarn.lock ./
RUN yarn install --frozen-lockfile

COPY package.json yarn.lock .yarnrc.yml ./
COPY .yarn ./.yarn

RUN yarn set version berry
RUN yarn install --immutable
RUN yarn add sharp

# Building Website
FROM node:18-alpine AS builder
# Build Image
FROM node:20-alpine AS builder
WORKDIR /app
COPY --from=deps /app/node_modules ./node_modules
COPY . .
RUN yarn build

ENV NEXT_TELEMETRY_DISABLED 1

# Keep as empty string as Typescript parses empty strings as false
ARG NEXT_PUBLIC_IS_PREVIEW=""
ENV NEXT_PUBLIC_IS_PREVIEW=$NEXT_PUBLIC_IS_PREVIEW
ARG NEXT_PUBLIC_BUILD_SHA
ENV NEXT_PUBLIC_BUILD_SHA=$NEXT_PUBLIC_BUILD_SHA
ARG NEXT_PUBLIC_BUILD_ID
ENV NEXT_PUBLIC_BUILD_ID=$NEXT_PUBLIC_BUILD_ID
ARG NEXT_PUBLIC_BUILD_NUM
ENV NEXT_PUBLIC_BUILD_NUM=$NEXT_PUBLIC_BUILD_NUM

RUN --mount=type=secret,id=REPOS_READ_ONLY \
REPOS_READ_ONLY=$(cat /run/secrets/REPOS_READ_ONLY) \
yarn build

# Production Image
FROM node:18-alpine AS runner
FROM node:20-alpine AS runner
WORKDIR /app
ENV NODE_ENV production
ENV NEXT_TELEMETRY_DISABLED 1

RUN addgroup -g 1001 -S nodejs
RUN adduser -S nextjs -u 1001

RUN addgroup --system --gid 1001 nextjsgroup
RUN adduser --system --uid 1001 nextjsuser
COPY --from=builder /app/public ./public

# Automatically leverage output traces to reduce image size
# https://nextjs.org/docs/advanced-features/output-file-tracing
COPY --from=builder --chown=nextjsuser:nextjsgroup /app/public ./public
COPY --from=builder --chown=nextjsuser:nextjsgroup /app/package.json ./package.json
COPY --from=builder --chown=nextjsuser:nextjsgroup /app/.next/standalone ./
COPY --from=builder --chown=nextjsuser:nextjsgroup /app/.next/static ./.next/static
COPY --from=builder --chown=nextjsuser:nextjsgroup /app/node_modules/next/dist/compiled/jest-worker ./node_modules/next/dist/compiled/jest-worker
COPY --from=builder --chown=nextjs:nodejs /app/.next/standalone ./
COPY --from=builder --chown=nextjs:nodejs /app/.next/static ./.next/static

USER nextjsuser
USER nextjs

EXPOSE 3000
ENTRYPOINT ["node", "server.js"]

ENV PORT 3000
ENV HOSTNAME localhost

CMD ["node", "server.js"]
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
</h1>

<h3 align="center">
<a href="https://goudham.com"><img src="assets/me-circle.png" width="150px" alt=""/></a><br>
<a href="https://goudham.com"><img src="public/profile-picture-circle.png" width="150px" alt=""/></a><br>
<img src="https://raw.githubusercontent.com/catppuccin/catppuccin/bbc6efd2096b8cfa82d00f8ad1099b1b2b34fc8f/assets/misc/transparent.png" height="30" width="0px"/>
<a href="https://goudham.com">✨ https://goudham.com ✨</a>
<img src="https://raw.githubusercontent.com/catppuccin/catppuccin/bbc6efd2096b8cfa82d00f8ad1099b1b2b34fc8f/assets/misc/transparent.png" height="30" width="0px"/>
Expand Down
File renamed without changes
27 changes: 27 additions & 0 deletions app/components/About.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
import { FancyUnderline, GroupedText, Text } from "./utils/Text";

export const About = () => {
return (
<GroupedText className="text-center">
<Text>
I am a{" "}
<FancyUnderline className="font-semibold" decoration="decoration-green">
software engineer
</FancyUnderline>{" "}
at the BBC and a{" "}
<FancyUnderline className="font-semibold" decoration="decoration-red">student</FancyUnderline>,
currently pursuing a BSc in Software Engineering at the University of
Glasgow.
</Text>
<Text>
You&apos;ll usually find me nerding out about technology and playing
video games. I also really enjoy contributing to open source projects,
mainly{" "}
<FancyUnderline className="font-semibold" decoration="decoration-peach">
Catppuccin
</FancyUnderline>
.
</Text>
</GroupedText>
);
};
103 changes: 103 additions & 0 deletions app/components/Footer.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,103 @@
import { Text } from "./utils/Text";
import {
GitHub,
Gitea,
Instagram,
LinkedIn,
Twitter,
} from "./icons/SocialMedia";
import Link from "next/link";
import { Heart } from "./icons/Heart";
import { ExternalLink } from "./icons/ExternalLink";

export const Footer = () => {
return (
<footer className="border-t-2 border-surface1 w-full text-subtext1">
<div className="flex flex-col justify-center items-center space-y-6 pt-10 pb-20">
<div className="text-center">
<p className="text-lg lg:text-xl xl:text-2xl">
Designed With <Heart />
</p>
<Text>&copy; {new Date().getFullYear()} Goudham Suresh</Text>
</div>
<BuildInfo />
<SocialMediaRow />
</div>
</footer>
);
};

const BuildInfo = () => {
return (
<div className="text-center text-md lg:text-lg xl:text-xl">
<p>{process.env.NEXT_PUBLIC_IS_PREVIEW ? "Preview" : "Release"} Build</p>
<p>
GitHub SHA:{" "}
<Link
rel="noopener noreferrer"
target="_blank"
className="hocus:underline hocus:decoration-solid hocus:underline-offset-1"
href={`https://github.com/sgoudham/website/commit/${process.env.NEXT_PUBLIC_BUILD_SHA}`}
>
{process.env.NEXT_PUBLIC_BUILD_SHA}&#8201;
<ExternalLink />
</Link>
</p>
<p>
Build ID:{" "}
<Link
rel="noopener noreferrer"
target="_blank"
className="hocus:underline hocus:decoration-solid hocus:underline-offset-1"
href={`https://github.com/sgoudham/website/actions/runs/${process.env.NEXT_PUBLIC_BUILD_ID}`}
>
{process.env.NEXT_PUBLIC_BUILD_ID}&#8201;
<ExternalLink />
</Link>
</p>
<p>Build Num: #{process.env.NEXT_PUBLIC_BUILD_NUM}</p>
</div>
);
};

const SocialMediaRow = () => {
return (
<div className="flex gap-3 items-center">
<a
className="group focus:ring-2 focus:ring-blue ring-offset-0"
aria-label="Follow Me On GitHub"
href="https://github.com/sgoudham"
>
<GitHub />
</a>
<a
className="group focus:ring-2 focus:ring-blue ring-offset-0"
aria-label="Visit My Gitea Instance"
href="https://gitea.goudham.com"
>
<Gitea />
</a>
<a
className="group focus:ring-2 focus:ring-blue ring-offset-0"
aria-label="Follow Me On LinkedIn"
href="https://linkedin.com/in/sgoudham"
>
<LinkedIn />
</a>
<a
className="group focus:ring-2 focus:ring-blue ring-offset-0"
aria-label="Follow Me On Twitter"
href="https://twitter.com/RealGoudham"
>
<Twitter />
</a>
<a
className="group focus:ring-2 focus:ring-blue ring-offset-0"
aria-label="Follow Me On Instagram"
href="https://instagram.com/sgoudham"
>
<Instagram />
</a>
</div>
);
};
14 changes: 14 additions & 0 deletions app/components/Header.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
import { Wave } from "./icons/Wave";
import { H1 } from "./utils/Titles";

export const Header = () => {
return (
<H1>
Hiya{" "}
<div className="inline-block motion-safe:animate-waving-hand">
<Wave />
</div>
, I&#39;m Goudham
</H1>
);
};
Loading

0 comments on commit e02fe18

Please sign in to comment.