docker: initial container creation

This commit is contained in:
Emmaline Autumn 2024-03-13 04:37:40 -06:00
parent d0cb74bea8
commit 4615f11cfa
6 changed files with 40 additions and 16 deletions

12
Dockerfile Normal file
View File

@ -0,0 +1,12 @@
FROM node:18.17.1-alpine
WORKDIR /ttc
ADD . .
RUN npm i
RUN npm run build
EXPOSE 3000
CMD [ "npm","start" ]

14
app/client.tsx Normal file
View File

@ -0,0 +1,14 @@
"use client";
import { TTCMD } from "@/components/ttcmd";
import { FC, use } from "react";
export const HomeClient: FC<{ body: Promise<string> }> = ({ body }) => {
const text = use(body);
return (
<TTCMD
body={text}
/>
);
};

View File

@ -1,9 +1,12 @@
import { readMD } from "@/actions/readMD";
import { TTCMD } from "@/components/ttcmd"; import { TTCMD } from "@/components/ttcmd";
import { readFile } from "fs/promises"; import { readFile } from "fs/promises";
import { Suspense } from "react"; import { Suspense } from "react";
import { HomeClient } from "./client";
import { Loader } from "@/components/loader";
export default function Home() { export default function Home() {
const body = readFile("./md/home.md", "utf-8"); const body = readMD("./md/home.md");
return ( return (
<> <>
<section className="heading"> <section className="heading">
@ -132,10 +135,8 @@ export default function Home() {
</cite> </cite>
</section> */ </section> */
} }
<Suspense> <Suspense fallback={<Loader />}>
<TTCMD <HomeClient body={body} />
body={body}
/>
</Suspense> </Suspense>
</> </>
); );

7
hooks/types.d.ts vendored Normal file
View File

@ -0,0 +1,7 @@
export type InputBinder = {
name: string;
value: string | number;
onChange: (
e: ChangeEvent<HTMLInputElement | HTMLTextAreaElement | HTMLSelectElement>,
) => void;
};

View File

@ -1,5 +1,5 @@
import React, { ChangeEvent, useCallback, useState } from "react"; import React, { ChangeEvent, useCallback, useState } from "react";
import { InputBinder } from "../types/inputBinder"; import { InputBinder } from "./types";
type ObjectStateHookConfig = { type ObjectStateHookConfig = {
disallowSpaces?: boolean; disallowSpaces?: boolean;

View File

@ -1,10 +0,0 @@
import { useEffect, useRef } from 'react'
import { QueryParams } from '../utils/queryParams'
export const useQueryParams = (options?: {clean: boolean}) => {
const queryParams = useRef(new QueryParams(options))
useEffect(() => {
console.log(queryParams.current.get('test'))
}, [queryParams.current])
}