Приложение развертывается... но я не получаю НИКАКОГО стиля CSS.Файл Docker:
Код: Выделить всё
# Step 1: Use the official Node.js image for building the app
FROM node:18 AS build
# Set the working directory in the container
WORKDIR /usr/src/app
# Copy package.json and package-lock.json (if available)
COPY package*.json ./
# Install dependencies
RUN npm install
# Copy the rest of the application code
COPY . .
# Build the app for production
RUN npm run build
# Step 2: Serve the built app using Nginx
FROM nginx:alpine
# Copy the built React app from the build stage to the Nginx HTML directory
COPY --from=build /usr/src/app/build /usr/share/nginx/html
# Copy the custom Nginx configuration
COPY nginx.conf /etc/nginx/nginx.conf
# Expose the port that Nginx serves on (default 80)
EXPOSE 80
# Use Nginx to serve the app
CMD ["nginx", "-g", "daemon off;"]
Код: Выделить всё
worker_processes auto; # Automatically set the number of worker processes based on available CPU cores
events {
worker_connections 1024; # Maximum number of simultaneous connections -- PER -- worker process
}
http {
include /usr/share/nginx/mime.types;
sendfile on;
server {
listen 80; # IPv4
listen [::]:80; # IPv6
server_name _;
root /usr/share/nginx/html;
index index.html
location / {
try_files $uri /index.html =404;
}
# Optionally, you can add headers or other settings if needed
}
}
Что я вижу в источниках из инструментов отладки Chrome
Является ли "нормальным" отсутствие index.html ???
Однако custom.css кажется, указывает на основной файл CSS??

Локальная сборкакогда я запускаю npm run build, я вижу это в коде VS
И приложение имеет стиль CSS.
обратите внимание, что здесь есть файл index.html и он указывает на основной файл CSS.

Справочные статьи
Я прочитал (и попробовал) эти
Переполнение стека
из веб
Средний
Подробнее здесь: https://stackoverflow.com/questions/793 ... -react-app