This commit is contained in:
Parsa Nazer
2025-11-10 13:36:36 +03:30
parent 75e7c64aab
commit 8453a4e400
+13 -19
View File
@@ -1,31 +1,25 @@
FROM oven/bun:1 AS build-stage
# --- Base build + production image ---
FROM node:20-slim AS app
WORKDIR /app
# Install sharp dependencies for Linux
# Install dependencies needed to build sharp
RUN apt-get update && apt-get install -y \
python3 \
make \
g++ \
&& rm -rf /var/lib/apt/lists/*
&& rm -rf /var/lib/apt/lists/*
COPY package.json bun.lockb* ./
RUN bun install --frozen-lockfile
# Copy package files and install dependencies
COPY package*.json ./
RUN npm ci --omit=dev
# Copy project files and build
COPY . .
RUN bun run build
FROM oven/bun:1 AS production-stage
WORKDIR /app
# Install sharp dependencies in production stage as well
RUN apt-get update && apt-get install -y \
python3 \
make \
g++ \
&& rm -rf /var/lib/apt/lists/*
COPY --from=build-stage /app /app
RUN npm run build
# Expose port and set env vars
EXPOSE 3000
ENV NODE_ENV=production
CMD ["bun", "run", "start"]
# Start the app
CMD ["npm", "run", "start"]