Skip to content

Commit

Permalink
bot: fix workdir
Browse files Browse the repository at this point in the history
  • Loading branch information
Behzad-rabiei committed Oct 24, 2024
1 parent 4e74991 commit 8fea8f2
Showing 1 changed file with 25 additions and 14 deletions.
39 changes: 25 additions & 14 deletions bot/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,19 +1,30 @@
FROM node:18-alpine AS base

# @pyroscope/nodejs issue: https://github.com/grafana/pyroscope-nodejs/issues/31
RUN apk add g++ make py3-pip

# Stage 1: Build the application
FROM node:20-alpine AS builder
WORKDIR /app
COPY . .
COPY bot/package*.json ./
RUN npm ci

FROM base AS test
CMD [ "npx", "jest", "--coverage" ]

FROM base AS build
COPY bot/ .
RUN npm run build

FROM build AS prod
# Stage 2: Development
FROM node:20-alpine AS development
WORKDIR /app
COPY --from=builder /app .
RUN npm install --only=development
EXPOSE 3000
CMD ["npm", "run", "dev"]

# Stage 3: Production
FROM node:20-alpine AS production
WORKDIR /app
COPY --from=builder /app .
RUN npm ci --omit=dev
CMD ["npm", "run", "start"]
EXPOSE 3000
EXPOSE 3000
CMD ["node", "dist/main"]

# Stage 4: Testing
FROM node:20-alpine AS test
WORKDIR /app
COPY --from=builder /app .
RUN npm install --only=development
CMD ["npx", "jest", "--coverage"]

0 comments on commit 8fea8f2

Please sign in to comment.