mirror of
https://github.com/xlorepdarkhelm/numinar-coding-project.git
synced 2026-09-05 22:58:26 -04:00
38 lines
810 B
Docker
38 lines
810 B
Docker
# Build stage
|
|
FROM node:24.6.0 AS builder
|
|
|
|
# Setting working directory for build
|
|
WORKDIR /app
|
|
|
|
# Copying package.json and package-lock.json to leverage Docker cache
|
|
COPY package*.json ./
|
|
|
|
# Copying TypeScript configuration
|
|
COPY tsconfig.json ./
|
|
|
|
# Installing dependencies
|
|
RUN npm install
|
|
|
|
# Copying the rest of the application code
|
|
COPY . .
|
|
|
|
# Building the TypeScript React app for production
|
|
RUN npm run build
|
|
|
|
# Production stage
|
|
FROM node:24.6.0-slim
|
|
|
|
# Setting working directory
|
|
WORKDIR /app
|
|
|
|
# Installing serve to run the production build
|
|
RUN npm install -g serve
|
|
|
|
# Copying only the build output from the builder stage
|
|
COPY --from=builder /app/build ./build
|
|
|
|
# Exposing the port the app will run on
|
|
EXPOSE 3000
|
|
|
|
# Starting the server to serve the built React app
|
|
CMD ["serve", "-s", "build", "-l", "3000"] |