fixed dockerfile
continuous-integration/drone/push Build is passing Details
continuous-integration/drone/pr Build encountered an error Details

This commit is contained in:
hardik 2025-09-28 20:32:13 +05:30
parent eb6a166715
commit f0277d6006
1 changed files with 45 additions and 6 deletions

View File

@ -1,8 +1,47 @@
# Use lightweight Nginx image # ------------------------
FROM scratch # Build stage
# ------------------------
FROM node:22-bullseye AS builder
# Copy your HTML/CSS/JS files into nginx's web root ARG API_BASE_URL="https://navigolabs.com/api"
COPY . /app/build
# Start nginx # Enable Corepack and Yarn 4
CMD ["tail", "-f", "/dev/null"] RUN corepack enable && corepack prepare yarn@4.9.2 --activate
WORKDIR /app
# Copy Yarn 4 files
COPY package.json yarn.lock .yarnrc.yml ./
COPY .yarn .yarn
# Install dependencies (immutable to match lockfile)
RUN yarn install --immutable
# Copy all source files
COPY . .
# Pass API URL to Vite
ENV VITE_API_BASE_URL=$API_BASE_URL
# Build the app
RUN yarn build
# ------------------------
# Production stage
# ------------------------
FROM node:22-alpine AS production
WORKDIR /app
# Copy built files from builder stage
COPY --from=builder /app/dist ./dist
# Install a lightweight static server
RUN npm install -g serve@14
# Expose port (optional but recommended)
EXPOSE 3000
# Start the static server
CMD ["serve", "-s", "dist", "-l", "3000"]