Skip to content

Commit

Permalink
[Dockerfile] Add
Browse files Browse the repository at this point in the history
  • Loading branch information
lexisother committed Apr 2, 2023
1 parent 9207ffc commit 290ca9b
Showing 1 changed file with 43 additions and 0 deletions.
43 changes: 43 additions & 0 deletions Dockerfile
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" ]

0 comments on commit 290ca9b

Please sign in to comment.