feat(docker): enable containerization of marketplace scraper
Introduce Dockerfile with production build using Bun, .dockerignore for efficient builds, and docker-compose.yml for easy local and prod deployment on port 3000.
This commit is contained in:
32
Dockerfile
Normal file
32
Dockerfile
Normal file
@@ -0,0 +1,32 @@
|
||||
# Use the official Bun base image
|
||||
FROM oven/bun:latest AS base
|
||||
|
||||
# Set the working directory
|
||||
WORKDIR /app
|
||||
|
||||
# Copy package files
|
||||
COPY package.json bun.lock* ./
|
||||
|
||||
# Install dependencies
|
||||
RUN bun install --frozen-lockfile
|
||||
|
||||
# Copy source code
|
||||
COPY src ./src
|
||||
COPY tsconfig.json ./
|
||||
|
||||
# Build the application for production
|
||||
RUN bun build ./src/index.ts --outdir ./dist --minify
|
||||
|
||||
# Multi-stage build - runtime stage
|
||||
FROM oven/bun:latest AS runtime
|
||||
|
||||
WORKDIR /app
|
||||
|
||||
# Copy the built application from the base stage
|
||||
COPY --from=base /app/dist/ ./
|
||||
|
||||
# Expose the port the app runs on
|
||||
EXPOSE 3000
|
||||
|
||||
# Start the application
|
||||
CMD ["bun", "index.js"]
|
||||
Reference in New Issue
Block a user