Commit
This commit is contained in:
File diff suppressed because one or more lines are too long
@@ -1 +1 @@
|
||||
{"version":1,"resource":"vscode-remote://coder.karmaashomepage.online/home/bugattiguy527/Dockerfile","entries":[{"id":"UqhJ","timestamp":1732636530341},{"id":"obRf","timestamp":1732636548561},{"id":"abiG","timestamp":1732636571673},{"id":"nkvD","timestamp":1732636588673},{"id":"ubTA","timestamp":1732636760308}]}
|
||||
{"version":1,"resource":"vscode-remote://coder.karmaashomepage.online/home/bugattiguy527/Dockerfile","entries":[{"id":"UqhJ","timestamp":1732636530341},{"id":"obRf","timestamp":1732636548561},{"id":"abiG","timestamp":1732636571673},{"id":"nkvD","timestamp":1732636588673},{"id":"ubTA","timestamp":1732636760308},{"id":"uFei","timestamp":1732650991346}]}
|
||||
@@ -30,6 +30,6 @@ COPY package*.json ./
|
||||
RUN npm install
|
||||
|
||||
# Copy server.js from its new location
|
||||
COPY /app/src/components/server.js /app/src/components
|
||||
COPY /app/src/components/server.js /app
|
||||
EXPOSE 3001
|
||||
CMD ["node", "/app/src/components/server.js"]
|
||||
35
.local/share/code-server/User/History/2e659bb2/eNc9
Normal file
35
.local/share/code-server/User/History/2e659bb2/eNc9
Normal file
@@ -0,0 +1,35 @@
|
||||
# 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
|
||||
|
||||
# Copy server.js from its new location
|
||||
COPY /app/src/components/server.js /app
|
||||
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}]}
|
||||
{"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}]}
|
||||
@@ -1 +1 @@
|
||||
{"pid":287,"willReleaseAt":0}
|
||||
{"pid":75467,"willReleaseAt":0}
|
||||
@@ -1,24 +0,0 @@
|
||||
services:
|
||||
frontend:
|
||||
build:
|
||||
context: /workspaces/codespaces-react # Path to your project root
|
||||
dockerfile: Dockerfile
|
||||
target: frontend-server # Building the frontend server
|
||||
ports:
|
||||
- "80:80" # Port mapping for HTTP traffic
|
||||
networks:
|
||||
- app-network
|
||||
|
||||
backend:
|
||||
build:
|
||||
context: /workspaces/codespaces-react # Path to your project root
|
||||
dockerfile: Dockerfile
|
||||
target: backend # Building the backend
|
||||
ports:
|
||||
- "3005:3005" # Port mapping for your Node backend
|
||||
networks:
|
||||
- app-network
|
||||
|
||||
networks:
|
||||
app-network: # Define a network for containers to communicate
|
||||
driver: bridge
|
||||
@@ -1,42 +1,35 @@
|
||||
# Stage 1: Build React frontend
|
||||
FROM node:18-slim as build
|
||||
|
||||
# Set working directory
|
||||
# Stage 1: Build the React app (Frontend)
|
||||
FROM node:18-slim AS frontend-build
|
||||
WORKDIR /app
|
||||
|
||||
# Copy project files
|
||||
# Copy all project files into the image
|
||||
COPY . .
|
||||
|
||||
# Install dependencies and build the frontend
|
||||
# Install dependencies
|
||||
RUN npm install
|
||||
|
||||
# Build the application
|
||||
RUN npm run build
|
||||
|
||||
# Stage 2: Backend + Nginx setup
|
||||
FROM node:18-slim
|
||||
# Stage 2: Setup Nginx to serve the React App
|
||||
FROM nginx:alpine AS frontend-server
|
||||
|
||||
# Set working directory for the backend
|
||||
# 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 backend files and entrypoint script
|
||||
COPY . .
|
||||
COPY entrypoint.sh /usr/local/bin/
|
||||
RUN chmod +x /usr/local/bin/entrypoint.sh
|
||||
# Copy package.json and package-lock.json
|
||||
COPY package*.json ./
|
||||
|
||||
# Install backend dependencies
|
||||
# Install dependencies
|
||||
RUN npm install
|
||||
|
||||
# Copy the React frontend build into a directory for Nginx
|
||||
RUN mkdir -p /usr/share/nginx/html
|
||||
COPY --from=build /app/dist /usr/share/nginx/html
|
||||
|
||||
# Install Nginx
|
||||
RUN apt-get update && apt-get install -y nginx && apt-get clean
|
||||
|
||||
# Copy Nginx configuration
|
||||
COPY /docker/nginx.conf /etc/nginx/conf.d/default.conf
|
||||
|
||||
# Expose the ports
|
||||
EXPOSE 80 3001
|
||||
|
||||
# Start both the backend and Nginx
|
||||
CMD ["/usr/local/bin/entrypoint.sh"]
|
||||
# Copy server.js from its new location
|
||||
COPY /app/src/components/server.js /app
|
||||
EXPOSE 3001
|
||||
CMD ["node", "/app/src/components/server.js"]
|
||||
Reference in New Issue
Block a user