Skip to content
This repository has been archived by the owner on Sep 25, 2023. It is now read-only.

chore: added api dockerfile wip #95

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 34 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
FROM node:16.14.2-alpine as pnpm
ENV PNPM_VERSION 7.14.2
RUN apk --no-cache add curl
RUN curl -sL https://unpkg.com/@pnpm/self-installer | node

FROM pnpm as install
ENV NPM_CONFIG_LOGLEVEL error
WORKDIR /usr/src/app
COPY pnpm-lock.yaml ./
COPY pnpm-workspace.yaml ./
COPY api/package.json ./api/package.json
COPY *.json ./
COPY schema ./schema
COPY prisma ./prisma
RUN pnpm install --frozen-lockfile
COPY . .
RUN pnpm build:api


FROM install as builder
WORKDIR /usr/src/app
COPY pnpm-lock.yaml ./
COPY pnpm-workspace.yaml ./
COPY api/package.json ./api/package.json
COPY package.json ./
COPY schema ./schema
COPY prisma ./prisma
RUN pnpm install --frozen-lockfile --ignore-scripts --reporter=append-only --filter @mirai/api && \
pnpm store prune && \
rm -rf ~/.pnpm-store
COPY --from=install /usr/src/app/api/dist ./api/dist
EXPOSE 4444

CMD ["npm", "run", "start:api"]
11 changes: 5 additions & 6 deletions api/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,9 @@
"build": "tsc",
"start-1": "prisma migrate deploy --schema=../prisma/schema.prisma",
"start-2": "cross-env NODE_ENV=production node dist/app.js",
"postinstall": "prisma generate --schema=../prisma/schema.prisma",
"start": "run-s start-*",
"studio": "cross-env DATABASE_URL=postgresql://postgres:@localhost:5632/mirai prisma studio --schema=../prisma/schema.prisma"
"start": "npm run start-1 && npm run start 2",
"studio": "cross-env DATABASE_URL=postgresql://postgres:@localhost:5632/mirai prisma studio --schema=../prisma/schema.prisma",
"postinstall": "prisma generate --schema=../prisma/schema.prisma"
},
"prisma": {
"seed": "pnpm ts-node ../prisma/seed.ts"
Expand All @@ -35,19 +35,18 @@
"dotenv": "^16.0.3",
"fastify": "^4.8.1",
"fastify-plugin": "^4.3.0",
"next-auth": "*",
"pg-boss": "^8.1.1",
"pino": "^8.6.1",
"pino-pretty": "^9.1.1",
"prisma": "^4.6.1",
"prisma-exclude": "^1.0.2",
"superjson": "^1.11.0",
"@prisma/client": "*",
"ts-node-dev": "^2.0.0"
},
"devDependencies": {
"@mirai/schema": "workspace:*",
"@swc/core": "*",
"@types/ws": "^8.5.3",
"typescript": "*"
"@types/ws": "^8.5.3"
}
}
4 changes: 2 additions & 2 deletions app/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@
"@headlessui/react": "^1.7.4",
"@hookform/resolvers": "^2.9.9",
"@popperjs/core": "^2.11.6",
"@prisma/client": "*",
"@trpc/client": "^9.27.4",
"@trpc/next": "^9.27.4",
"@trpc/react": "^9.27.4",
Expand All @@ -39,7 +38,8 @@
"reconnecting-websocket": "^4.4.0",
"superjson": "^1.11.0",
"ws": "^8.11.0",
"@mirai/schema": "workspace:*"
"@mirai/schema": "workspace:*",
"@prisma/client": "*"
},
"devDependencies": {
"@iconify-json/ph": "^1.1.2",
Expand Down
5 changes: 2 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
"type-check": "tsc --pretty --noEmit --incremental --tsBuildInfoFile \"temp/.tsBuildInfo\" -p tsconfig.check.json",
"build-schema": "pnpm run --filter @mirai/schema build",
"dev:schema": "pnpm run --filter @mirai/schema dev",
"postinstall": "pnpm run build-schema"
"postinstall": "run-s build-schema"
},
"lint-staged": {
"*.{js,ts,tsx}": [
Expand All @@ -31,8 +31,6 @@
},
"dependencies": {
"@mirai/api": "workspace:*",
"@mirai/app": "workspace:*",
"@prisma/client": "^4.6.1",
"bcryptjs": "^2.4.3",
"cross-env": "^7.0.3",
"dayjs": "^1.11.6",
Expand All @@ -45,6 +43,7 @@
},
"devDependencies": {
"@types/bcryptjs": "^2.4.2",
"@prisma/client": "^4.6.1",
"@types/jsonwebtoken": "^8.5.9",
"@types/lodash": "^4.14.186",
"@types/node": "^18.11.0",
Expand Down
35 changes: 21 additions & 14 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.