Compare commits

..

No commits in common. "ac14112eed163bade7d9722415d4a33340e8f28a" and "2eb60f12a037a43a8fe89fa949d9c832edbe08dc" have entirely different histories.

5 changed files with 7 additions and 54 deletions

View File

@ -1,4 +0,0 @@
.next/
node_modules/
.env*
next-env.d.ts

View File

@ -1,26 +0,0 @@
name: Build
on:
push:
branches:
- main
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Login to Docker
uses: https://github.com/docker/login-action@v3
with:
registry: git.nrx.sh
username: ${{ secrets.docker_username }}
password: ${{ secrets.docker_password }}
- name: Build Docker image
run: |
docker build -t nrx-sh:latest . && \
docker tag nrx-sh:latest git.nrx.sh/naresh/nrx-sh:latest && \
docker push git.nrx.sh/naresh/nrx-sh:latest

View File

@ -1,21 +0,0 @@
FROM node:current-alpine AS build
WORKDIR /app
COPY package.json package-lock.json ./
RUN npm install
COPY ./prisma ./prisma
RUN npx prisma generate
COPY ./next.config.ts ./tsconfig.json ./eslint.config.mjs ./
COPY ./src ./src
RUN npm run build
RUN cp -r .next/static .next/standalone/.next/
FROM node:current-alpine AS production
COPY --from=build /app/.next/standalone /app
EXPOSE 3000
WORKDIR /app
CMD ["node", "server.js"]

View File

@ -7,7 +7,7 @@ import ReCAPTCHA from "react-google-recaptcha";
export default function ContactComponent({ export default function ContactComponent({
recaptchaSiteKey, recaptchaSiteKey,
}: { }: {
recaptchaSiteKey: string | undefined; recaptchaSiteKey: string;
}) { }) {
const inputStyle = { const inputStyle = {
backgroundColor: "#111", backgroundColor: "#111",
@ -57,7 +57,7 @@ export default function ContactComponent({
{"success" in state && "Submitted successfully!"} {"success" in state && "Submitted successfully!"}
</span> </span>
)} )}
<ReCAPTCHA sitekey={recaptchaSiteKey ?? ""} theme="dark" /> <ReCAPTCHA sitekey={recaptchaSiteKey} theme="dark" />
<button <button
type="submit" type="submit"
style={{ style={{
@ -71,7 +71,7 @@ export default function ContactComponent({
onMouseLeave={(e) => { onMouseLeave={(e) => {
if (!pending) e.currentTarget.style.backgroundColor = "#111"; if (!pending) e.currentTarget.style.backgroundColor = "#111";
}} }}
disabled={pending || recaptchaSiteKey == null} disabled={pending}
> >
{pending ? "Sending..." : "Submit"} {pending ? "Sending..." : "Submit"}
</button> </button>

View File

@ -4,5 +4,9 @@ import ContactComponent from "./ContactComponent";
export default async function ContactPage() { export default async function ContactPage() {
const recaptchaSiteKey = process.env.RECAPTCHA_SITE_KEY; const recaptchaSiteKey = process.env.RECAPTCHA_SITE_KEY;
if (!recaptchaSiteKey) {
console.error("ReCAPTCHA site key is not set");
throw new Error("ReCAPTCHA not correctly configured");
}
return <ContactComponent recaptchaSiteKey={recaptchaSiteKey} />; return <ContactComponent recaptchaSiteKey={recaptchaSiteKey} />;
} }