Files
todo-app/Dockerfile

30 lines
573 B
Docker

FROM oven/bun:1 as builder
WORKDIR /app
# Copy the entire repo
COPY . .
# Install dependencies for API
WORKDIR /app/apps/api
RUN bun install --frozen-lockfile
# Production image
FROM oven/bun:1-slim
WORKDIR /app
# Copy from builder
COPY --from=builder /app/apps/api/node_modules ./node_modules
COPY --from=builder /app/apps/api/package.json ./
COPY --from=builder /app/apps/api/src ./src
COPY --from=builder /app/apps/api/drizzle.config.ts ./
# Set environment
ENV NODE_ENV=production
ENV PORT=3001
EXPOSE 3001
CMD ["sh", "-c", "bun run db:push && bun run start"]