diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..3ac3c5f --- /dev/null +++ b/Dockerfile @@ -0,0 +1,22 @@ +# Stage 1: Build React app +FROM node:18 as build + +WORKDIR /app + +COPY package.json package-lock.json ./ + +RUN npm install + +COPY . . + +RUN npm run build + +# Stage 2: Serve with nginx +FROM nginx:alpine + +COPY --from=build /app/build /usr/share/nginx/html + +# Expose port 80 +EXPOSE 80 + +CMD ["nginx", "-g", "daemon off;"] diff --git a/docker-compose.yml b/docker-compose.yml new file mode 100644 index 0000000..cebf437 --- /dev/null +++ b/docker-compose.yml @@ -0,0 +1,18 @@ +version: '3.8' + +services: + backend: + build: + context: ./backend + ports: + - "5000:5000" + environment: + - NODE_ENV=production + + frontend: + build: + context: ./frontend + ports: + - "3000:80" + environment: + - NODE_ENV=production