Commit
This commit is contained in:
1 parent
54510d0fbf
commit
a9e652b1c8
13 files changed
+74
-17
No files matched your search
@@ -0,0 +1,29 @@
|
||||
# Stage 1: Build the React app (Frontend)
|
||||
FROM node:18-slim AS frontend-build
|
||||
WORKDIR /app
|
||||
|
||||
# Copy frontend files
|
||||
COPY frontend/package*.json ./frontend/
|
||||
WORKDIR /app/frontend
|
||||
RUN npm install
|
||||
COPY frontend/ .
|
||||
RUN npm run build
|
||||
|
||||
# Stage 2: Setup Nginx to serve the React App
|
||||
FROM nginx:alpine AS frontend-server
|
||||
COPY --from=frontend-build /app/frontend/dist /usr/share/nginx/html
|
||||
EXPOSE 80
|
||||
CMD ["nginx", "-g", "daemon off;"]
|
||||
|
||||
# Stage 3: Setup the Backend
|
||||
FROM node:18-slim AS backend
|
||||
WORKDIR /app
|
||||
|
||||
# Copy backend files
|
||||
COPY backend/package*.json ./
|
||||
RUN npm install
|
||||
COPY backend/ .
|
||||
|
||||
# Run backend
|
||||
EXPOSE 3001
|
||||
CMD ["node", "/app/src/components/server.js"]
|
||||
@@ -1 +1 @@
|
||||
{"version":1,"resource":"vscode-remote://coder.karmaashomepage.online/home/bugattiguy527/docker/Dockerfile","entries":[{"id":"TUF1","timestamp":1732635492973},{"id":"8otg","timestamp":1732635506681},{"id":"XU8z","source":"undoRedo.source","timestamp":1732635515769},{"id":"ars1","timestamp":1732635532917},{"id":"8UPb","timestamp":1732635628577},{"id":"gWeB","timestamp":1732635658901},{"id":"Z5sv","source":"undoRedo.source","timestamp":1732635671649},{"id":"J4VB","timestamp":1732635674581},{"id":"eNc9","timestamp":1732651223530}]}
|
||||
{"version":1,"resource":"vscode-remote://coder.karmaashomepage.online/home/bugattiguy527/docker/Dockerfile","entries":[{"id":"TUF1","timestamp":1732635492973},{"id":"8otg","timestamp":1732635506681},{"id":"XU8z","source":"undoRedo.source","timestamp":1732635515769},{"id":"ars1","timestamp":1732635532917},{"id":"8UPb","timestamp":1732635628577},{"id":"gWeB","timestamp":1732635658901},{"id":"Z5sv","source":"undoRedo.source","timestamp":1732635671649},{"id":"J4VB","timestamp":1732635674581},{"id":"eNc9","timestamp":1732651223530},{"id":"qz6w","timestamp":1732666102382},{"id":"dg9u","timestamp":1732666385636}]}
|
||||
@@ -0,0 +1,34 @@
|
||||
# Stage 1: Build the React app (Frontend)
|
||||
FROM node:18-slim AS frontend-build
|
||||
WORKDIR /app
|
||||
|
||||
# Copy all project files into the image
|
||||
COPY . .
|
||||
|
||||
# Install dependencies
|
||||
RUN npm install
|
||||
|
||||
# Build the application
|
||||
RUN npm run build
|
||||
|
||||
# Stage 2: Setup Nginx to serve the React App
|
||||
FROM nginx:alpine AS frontend-server
|
||||
|
||||
# Copy built files from builder stage to nginx
|
||||
COPY --from=frontend-build /app/dist /usr/share/nginx/html
|
||||
EXPOSE 80
|
||||
CMD ["nginx", "-g", "daemon off;"]
|
||||
|
||||
# Stage 3: Setup the Backend
|
||||
FROM node:18-slim AS backend
|
||||
WORKDIR /app
|
||||
|
||||
# Copy package.json and package-lock.json
|
||||
COPY package*.json ./
|
||||
|
||||
# Install dependencies
|
||||
RUN npm install
|
||||
|
||||
# Run backend
|
||||
EXPOSE 3001
|
||||
CMD ["node", "/app/src/components/server.js"]
|
||||
@@ -1 +1 @@
|
||||
{"pid":75467,"willReleaseAt":0}
|
||||
{"pid":136632,"willReleaseAt":0}
|
||||
File renamed without changes.
+9
-15
@@ -2,20 +2,16 @@
|
||||
FROM node:18-slim AS frontend-build
|
||||
WORKDIR /app
|
||||
|
||||
# Copy all project files into the image
|
||||
COPY . .
|
||||
|
||||
# Install dependencies
|
||||
# Copy frontend files
|
||||
COPY frontend/package*.json ./frontend/
|
||||
WORKDIR /app/frontend
|
||||
RUN npm install
|
||||
|
||||
# Build the application
|
||||
COPY frontend/ .
|
||||
RUN npm run build
|
||||
|
||||
# Stage 2: Setup Nginx to serve the React App
|
||||
FROM nginx:alpine AS frontend-server
|
||||
|
||||
# Copy built files from builder stage to nginx
|
||||
COPY --from=frontend-build /app/dist /usr/share/nginx/html
|
||||
COPY --from=frontend-build /app/frontend/dist /usr/share/nginx/html
|
||||
EXPOSE 80
|
||||
CMD ["nginx", "-g", "daemon off;"]
|
||||
|
||||
@@ -23,13 +19,11 @@ CMD ["nginx", "-g", "daemon off;"]
|
||||
FROM node:18-slim AS backend
|
||||
WORKDIR /app
|
||||
|
||||
# Copy package.json and package-lock.json
|
||||
COPY package*.json ./
|
||||
|
||||
# Install dependencies
|
||||
# Copy backend files
|
||||
COPY backend/package*.json ./
|
||||
RUN npm install
|
||||
COPY backend/ .
|
||||
|
||||
# Copy server.js from its new location
|
||||
COPY /app/src/components/server.js /app
|
||||
# Run backend
|
||||
EXPOSE 3001
|
||||
CMD ["node", "/app/src/components/server.js"]
|
||||
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Reference in new issue
Block a user