Skip to content

Commit

Permalink
v2.1.0: First CD Build (#28)
Browse files Browse the repository at this point in the history
* Type error fix.
* Copy prisma file to build dir so I can run `prisma generate`
* Add data dir to support attached volumes in Docker
* Bug fix for "blinking" between quizzes
* Style and dep updates
* Bug fix in how cards are dealt from deck for continuous flow mode.
  • Loading branch information
RickCarlino authored Oct 5, 2023
1 parent 0ae4630 commit b3be3bd
Show file tree
Hide file tree
Showing 20 changed files with 1,777 additions and 2,106 deletions.
2 changes: 1 addition & 1 deletion .eslintrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@
"rules": {
"react/no-unescaped-entities": 0
}
}
}
5 changes: 3 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ WORKDIR /app
COPY package.json package-lock.json ./
RUN npm install
COPY . .
RUN npm run build
RUN npx prisma generate
RUN npm run build
RUN npm prune --production

# Production Stage
Expand All @@ -15,11 +15,12 @@ COPY --from=builder /app/node_modules ./node_modules
COPY --from=builder /app/public ./public
COPY --from=builder /app/.next ./.next
COPY --from=builder /app/next.config.js ./next.config.js

COPY --from=builder /app/prisma ./prisma
# Set Environment Variable for Production
ENV NODE_ENV production

EXPOSE 3000

# Command to start the application
CMD ["node_modules/.bin/next", "start"]

2 changes: 1 addition & 1 deletion components/authed.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ const SignInButton: React.FC = () => {
<Container size="s">
<h1>Not Logged In</h1>
<Center style={{ height: "100%" }}>
<Button onClick={() => signIn()} size="xl" uppercase>
<Button onClick={() => signIn()} size="xl">
🔑 Click Here To Log In
</Button>
</Center>
Expand Down
54 changes: 26 additions & 28 deletions components/card-table.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Button, Grid, Table } from "@mantine/core";
import { Button, Table } from "@mantine/core";
import { IconPencil } from "@tabler/icons-react";
import { useRouter } from "next/router";
import React from "react";
Expand All @@ -19,33 +19,31 @@ interface PhraseTableProps {
export const CardTable: React.FC<PhraseTableProps> = ({ cards }) => {
const router = useRouter();
return (
<Grid>
<Table>
<thead>
<tr>
<th>ID</th>
<th>Flagged</th>
<th>English</th>
<th>Korean</th>
<th>Edit</th>
<Table>
<thead>
<tr>
<th>ID</th>
<th>Flagged</th>
<th>English</th>
<th>Korean</th>
<th>Edit</th>
</tr>
</thead>
<tbody>
{cards.map((card) => (
<tr key={card.id}>
<td>{card.id}</td>
<td>{card.flagged ? "🚩" : ""}</td>
<td>{card.phrase.definition}</td>
<td>{card.phrase.term}</td>
<td>
<Button onClick={() => router.push(`/cards/${card.id}`)}>
<IconPencil stroke={1.5} />
</Button>
</td>
</tr>
</thead>
<tbody>
{cards.map((card) => (
<tr key={card.id}>
<td>{card.id}</td>
<td>{card.flagged ? "🚩" : ""}</td>
<td>{card.phrase.definition}</td>
<td>{card.phrase.term}</td>
<td>
<Button onClick={() => router.push(`/cards/${card.id}`)}>
<IconPencil stroke={1.5} />
</Button>
</td>
</tr>
))}
</tbody>
</Table>
</Grid>
))}
</tbody>
</Table>
);
};
14 changes: 13 additions & 1 deletion example.env
Original file line number Diff line number Diff line change
@@ -1,3 +1,15 @@
EMAIL_FROM=[email protected]
EMAIL_SERVER_HOST="foo.bar.xyz"
EMAIL_SERVER_PASSWORD="password123"
EMAIL_SERVER_PORT="465"
EMAIL_SERVER_USER="[email protected]"
# Run `openssl rand -base64 32` to get a secure secret.
NEXTAUTH_SECRET=123456
NEXTAUTH_URL=https://A_REAL_DOMAIN_NAME
# Optional. Defaults to "." if left unset.
# You will need this on Docker/cloud native apps where
# you are required to attach storage volumes.
DATA_DIR=/data
# OpenAI API Key. You will need to sign up for an account and enter
# payment details.
OPENAI_API_KEY="Find this at https://platform.openai.com/account/api-keys"
Expand All @@ -19,4 +31,4 @@ GCP_JSON_CREDS='{"foo": "bar"}'
# Running this app is expensive. Set this ENV if
# (and only if!) you want to stop new users from using the
# app. This is a good way to keep costs down.
AUTHORIZED_EMAILS=[email protected]
AUTHORIZED_EMAILS=[email protected]
Loading

0 comments on commit b3be3bd

Please sign in to comment.