From de982c66087e389af9195150c8d396a73ab7afb0 Mon Sep 17 00:00:00 2001 From: Ayush Mukherjee Date: Tue, 1 Nov 2022 13:12:11 +0530 Subject: [PATCH] finish project --- Dockerfile | 32 ++++++++++++++++++++++++++++++++ README.md | 27 ++++++++++++++------------- 2 files changed, 46 insertions(+), 13 deletions(-) create mode 100644 Dockerfile diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..8d41a2e --- /dev/null +++ b/Dockerfile @@ -0,0 +1,32 @@ +FROM node:18-alpine AS builder + +WORKDIR "/app" + +COPY . . + +RUN npm ci + +RUN npm run build + +RUN npm prune --production + +FROM node:18-alpine AS prod + +WORKDIR "/app" + +COPY --from=builder /app/package.json ./package.json +COPY --from=builder /app/package-lock.json ./package-lock.json +COPY --from=builder /app/dist ./dist +COPY --from=builder /app/node_modules ./node_modules + +ENV DB_HOST +ENV DB_PORT +ENV DB_USER +ENV DB_PASS +ENV DB_NAME +ENV JWT_SECRET +ENV JWT_EXPIRY + +CMD ["sh", "-c", "DB_HOST=${DB_HOST} DB_PORT=${DB_PORT} DB_USER=${DB_USER} DB_PASS=${DB_PASS} DB_NAME=${DB_NAME} JWT_SECRET=${JWT_SECRET} JWT_EXPIRY=${JWT_EXPIRY} npm run start:prod --host 0.0.0.0"] + +EXPOSE 3000 diff --git a/README.md b/README.md index 0f86a82..4a8e2d1 100644 --- a/README.md +++ b/README.md @@ -1,16 +1,17 @@ # Mx Leaderboard API -## todos +Basic leaderboard api using next js, mariadb and typescript. -- [x] user api - - [x] signup - - [x] login -- [x] leaderboard api - - [x] add 20 pts - - [x] add 60 pts - - [x] add 100 pts - - [x] get standings - - [x] get user score history -- [x] controller tests - - [x] user - - [x] rank +## Development + +- Copy `.env.example` to `.env`, and add relevant information +- `pnpm install` +- `pnpm start:dev` + +## Deployment + +- Copy `.env.example` to `.env`, and add relevant information +- `npm run ci` +- `npm run build` +- `npm prune --production` +- `npm start:prod --host 0.0.0.0`