Files
Termix/.local/share/code-server/User/History/2e659bb2/b8fu
Luke Gustafson e159477406 Commit
2024-11-27 00:28:10 +00:00

31 lines
760 B
Plaintext

# Combined Frontend and Backend Setup
FROM node:18-slim AS combined-build
WORKDIR /app
# Copy and install frontend dependencies
COPY frontend/package*.json ./frontend/
WORKDIR /app/frontend
RUN npm install
COPY frontend/ .
RUN npm run build
# Copy frontend build output to /app directory
WORKDIR /app
RUN mkdir -p /app/public
COPY --from=combined-build /app/frontend/dist /app/public
# Setup backend
COPY backend/package*.json ./
RUN npm install
COPY backend/ .
# Setup Nginx to serve the React App
FROM nginx:alpine
COPY --from=combined-build /app/public /usr/share/nginx/html
# Expose ports for frontend and backend
EXPOSE 80
EXPOSE 3001
# Run backend and frontend servers
CMD ["sh", "-c", "node /app/src/components/server.js & nginx -g 'daemon off;'"]