diff --git a/Dockerfile b/Dockerfile index 44660868..f45f335f 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,4 +1,5 @@ -FROM node:20-alpine AS builder +# Stage 1: Build the static files +FROM node:22-alpine AS builder WORKDIR /app @@ -18,8 +19,18 @@ RUN npm install --legacy-peer-deps COPY . . +# Build the Docusaurus project +RUN npm run build + +# Stage 2: Serve the files using Nginx +FROM nginx:alpine + +# Copy the static files from builder stage +# Docusaurus builds to the "build" directory by default +COPY --from=builder /app/build /usr/share/nginx/html + # Expose the application port -EXPOSE 3000 +EXPOSE 80 -# Start the application -CMD ["npm", "run", "dev", "--", "--host", "0.0.0.0"] +# Start Nginx +CMD ["nginx", "-g", "daemon off;"] diff --git a/docker-compose.yml b/docker-compose.yml index 313de46b..dc6ab113 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -2,6 +2,7 @@ services: recodehive: build: context: . + target: builder ports: - "3000:3000" volumes: