healthy_oil/Dockerfile

44 lines
717 B
Docker

FROM node:18-alpine
WORKDIR /app
COPY package.json .
RUN npm installFROM node:18-alpine as build
WORKDIR /app
# Copy package files and install dependencies
COPY package.json package-lock.json* ./
RUN npm ci
# Copy all files
COPY . .
# Build the application
RUN npm run build
# Production stage
FROM node:18-alpine as production
WORKDIR /app
# Install serve globally
RUN npm install -g serve
# Copy built files from build stage
COPY --from=build /app/dist ./dist
EXPOSE 3000
# Use the -s flag to handle SPA routing
CMD ["serve", "-s", "dist", "-l", "3000"]
RUN npm install -g serve
COPY . .
RUN npm run build
EXPOSE 3000
# Serve the static files after building
CMD ["serve", "-s", "dist", "-l", "3000"]