From e0d4cb41b0d07c81e9329b7fabde6feba8f99b33 Mon Sep 17 00:00:00 2001 From: Mike Conrad Date: Thu, 31 Aug 2023 16:17:56 -0400 Subject: [PATCH] Added docker config --- .dockerignore | 1 + Dockerfile | 9 +++++++++ src/token.ts | 2 +- src/tokenList.ts | 2 +- tsconfig.json | 20 ++++++++++++++++++++ 5 files changed, 32 insertions(+), 2 deletions(-) create mode 100644 .dockerignore create mode 100644 Dockerfile create mode 100644 tsconfig.json diff --git a/.dockerignore b/.dockerignore new file mode 100644 index 0000000..dbf0821 --- /dev/null +++ b/.dockerignore @@ -0,0 +1 @@ +node_modules/* \ No newline at end of file diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..dc5ba58 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,9 @@ +FROM node:18 AS Build +WORKDIR /app/node/ +COPY . . +RUN yarn +RUN yarn build + +FROM nginx AS Production +WORKDIR /usr/share/nginx/html +COPY --from=Build /app/node/dist /usr/share/nginx/html/ diff --git a/src/token.ts b/src/token.ts index a2ad1eb..704bb65 100644 --- a/src/token.ts +++ b/src/token.ts @@ -2,7 +2,7 @@ import totp from 'totp-generator' const period = 30 const digits = 6 -export function displayToken(secret) { +export function displayToken(secret: string) { const token = totp(secret.replace(/ /g, '').trim(), { digits, period, diff --git a/src/tokenList.ts b/src/tokenList.ts index bf04376..dd8b529 100644 --- a/src/tokenList.ts +++ b/src/tokenList.ts @@ -1,4 +1,4 @@ -import { displayTokenListItem } from "./TokenListItem"; +import { displayTokenListItem } from "./tokenListItem"; import { tokens } from "./tokens"; export function tokenList() { diff --git a/tsconfig.json b/tsconfig.json new file mode 100644 index 0000000..5494e45 --- /dev/null +++ b/tsconfig.json @@ -0,0 +1,20 @@ +{ + "compilerOptions": { + "target": "ESNext", + "lib": ["DOM", "DOM.Iterable", "ESNext"], + "types": [], + "allowJs": false, + "skipLibCheck": false, + "esModuleInterop": false, + "allowSyntheticDefaultImports": true, + "strict": true, + "forceConsistentCasingInFileNames": true, + "module": "ESNext", + "moduleResolution": "Node", + "resolveJsonModule": true, + "isolatedModules": true, + "noEmit": true, + "jsx": "react" + }, + "include": ["src"] + } \ No newline at end of file