-
-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
9207ffc
commit 290ca9b
Showing
1 changed file
with
43 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
## build runner | ||
FROM node:lts-alpine as build-runner | ||
|
||
# Set temp directory | ||
WORKDIR /tmp/app | ||
|
||
# Move package.json | ||
COPY package.json . | ||
|
||
# Install dependencies | ||
RUN npm install -g pnpm | ||
RUN pnpm install | ||
|
||
# Move source files | ||
COPY prisma ./prisma | ||
COPY src ./src | ||
COPY tsconfig.json . | ||
|
||
# Build project | ||
RUN pnpx prisma generate | ||
RUN pnpm run build | ||
|
||
## producation runner | ||
FROM node:lts-alpine as prod-runner | ||
|
||
# Set work directory | ||
WORKDIR /app | ||
|
||
# Copy package.json from build-runner | ||
COPY --from=build-runner /tmp/app/package.json /app/package.json | ||
# Copy prisma from build-runner | ||
COPY --from=build-runner /tmp/app/prisma /app/prisma | ||
|
||
# Install dependencies | ||
RUN npm install -g pnpm | ||
RUN pnpm install --only=production | ||
RUN pnpx prisma generate | ||
|
||
# Move build files | ||
COPY --from=build-runner /tmp/app/build /app/build | ||
|
||
# Start bot | ||
CMD [ "node", "build/main.js" ] |