Docker php bootstrap configuration does not load css properly

I am new to Docker, I am trying to set up a Docker configuration for adding Php, Nginx, Mysql, Bootstrap and Sb Admin 2 Theme. But the css is not loaded properly. Below the configuration:

docker-compose.yml

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
<code>version: '3.3'
</code>
<code>version: '3.3' </code>
version: '3.3'

services:
php:
build:
context: .
dockerfile: Dockerfile
volumes:
– ./www:/var/www/html
depends_on:
– mysql

nginx:
image: nginx:latest
ports:
– “8080:80”
volumes:
– ./nginx.conf:/etc/nginx/nginx.conf
– ./www:/var/www/html
depends_on:
– php

mysql:
image: mysql:5.7
environment:
MYSQL_ROOT_PASSWORD: root
MYSQL_DATABASE: my_database
volumes:
– mysql_data:/var/lib/mysql

volumes:
mysql_data:

Dockerfile

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
<code># Use the official PHP image with Apache
FROM php:7.4-fpm
ENV NODE_VERSION=18.17.0
# Set working directory
WORKDIR /var/www/html
# Install system dependencies
RUN apt-get update && apt-get install -y
build-essential
libpng-dev
libjpeg62-turbo-dev
libfreetype6-dev
locales
zip
jpegoptim optipng pngquant gifsicle
vim
unzip
git
curl
&& apt-get clean && rm -rf /var/lib/apt/lists/*
# Install PHP extensions
RUN docker-php-ext-install pdo_mysql exif pcntl bcmath gd
# Install Composer
COPY --from=composer:latest /usr/bin/composer /usr/bin/composer
# Install Node.js and npm
RUN curl -sL https://deb.nodesource.com/setup_14.x | bash - &&
apt-get install -y nodejs
# Copy the application files
COPY ./www /var/www/html
# Install npm dependencies
RUN cd /var/www/html && npm install && npm run build
# Expose port 9000 and start php-fpm server
EXPOSE 9000
CMD ["php-fpm"]
</code>
<code># Use the official PHP image with Apache FROM php:7.4-fpm ENV NODE_VERSION=18.17.0 # Set working directory WORKDIR /var/www/html # Install system dependencies RUN apt-get update && apt-get install -y build-essential libpng-dev libjpeg62-turbo-dev libfreetype6-dev locales zip jpegoptim optipng pngquant gifsicle vim unzip git curl && apt-get clean && rm -rf /var/lib/apt/lists/* # Install PHP extensions RUN docker-php-ext-install pdo_mysql exif pcntl bcmath gd # Install Composer COPY --from=composer:latest /usr/bin/composer /usr/bin/composer # Install Node.js and npm RUN curl -sL https://deb.nodesource.com/setup_14.x | bash - && apt-get install -y nodejs # Copy the application files COPY ./www /var/www/html # Install npm dependencies RUN cd /var/www/html && npm install && npm run build # Expose port 9000 and start php-fpm server EXPOSE 9000 CMD ["php-fpm"] </code>
# Use the official PHP image with Apache
FROM php:7.4-fpm

ENV NODE_VERSION=18.17.0

# Set working directory
WORKDIR /var/www/html

# Install system dependencies
RUN apt-get update && apt-get install -y 
    build-essential 
    libpng-dev 
    libjpeg62-turbo-dev 
    libfreetype6-dev 
    locales 
    zip 
    jpegoptim optipng pngquant gifsicle 
    vim 
    unzip 
    git 
    curl 
    && apt-get clean && rm -rf /var/lib/apt/lists/*

# Install PHP extensions
RUN docker-php-ext-install pdo_mysql exif pcntl bcmath gd

# Install Composer
COPY --from=composer:latest /usr/bin/composer /usr/bin/composer

# Install Node.js and npm
RUN curl -sL https://deb.nodesource.com/setup_14.x | bash - && 
    apt-get install -y nodejs

# Copy the application files
COPY ./www /var/www/html

# Install npm dependencies
RUN cd /var/www/html && npm install && npm run build

# Expose port 9000 and start php-fpm server
EXPOSE 9000
CMD ["php-fpm"]

webpack.config.js

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
<code>const path = require('path');
module.exports = {
entry: './src/index.js',
output: {
filename: 'bundle.js',
path: path.resolve(__dirname, 'dist')
},
module: {
rules: [
{
test: /.css$/,
use: ['style-loader', 'css-loader']
},
{
test: /.(png|jpg|gif|svg|eot|ttf|woff|woff2)$/,
use: [
{
loader: 'file-loader',
options: {
name: '[name].[ext]',
outputPath: 'assets/'
}
}
]
}
]
}
};
</code>
<code>const path = require('path'); module.exports = { entry: './src/index.js', output: { filename: 'bundle.js', path: path.resolve(__dirname, 'dist') }, module: { rules: [ { test: /.css$/, use: ['style-loader', 'css-loader'] }, { test: /.(png|jpg|gif|svg|eot|ttf|woff|woff2)$/, use: [ { loader: 'file-loader', options: { name: '[name].[ext]', outputPath: 'assets/' } } ] } ] } }; </code>
const path = require('path');

module.exports = {
  entry: './src/index.js',
  output: {
    filename: 'bundle.js',
    path: path.resolve(__dirname, 'dist')
  },
  module: {
    rules: [
      {
        test: /.css$/,
        use: ['style-loader', 'css-loader']
      },
      {
        test: /.(png|jpg|gif|svg|eot|ttf|woff|woff2)$/,
        use: [
          {
            loader: 'file-loader',
            options: {
              name: '[name].[ext]',
              outputPath: 'assets/'
            }
          }
        ]
      }
    ]
  }
};

index.js

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
<code> import 'bootstrap/dist/css/bootstrap.min.css';
import 'startbootstrap-sb-admin-2/css/sb-admin-2.min.css';
import 'bootstrap/dist/js/bootstrap.bundle.min';
import 'jquery';
import 'startbootstrap-sb-admin-2/js/sb-admin-2.min';
// You can add custom JavaScript code here
console.log("Hello from Webpack!");
</code>
<code> import 'bootstrap/dist/css/bootstrap.min.css'; import 'startbootstrap-sb-admin-2/css/sb-admin-2.min.css'; import 'bootstrap/dist/js/bootstrap.bundle.min'; import 'jquery'; import 'startbootstrap-sb-admin-2/js/sb-admin-2.min'; // You can add custom JavaScript code here console.log("Hello from Webpack!"); </code>
   import 'bootstrap/dist/css/bootstrap.min.css';
   import 'startbootstrap-sb-admin-2/css/sb-admin-2.min.css';
   import 'bootstrap/dist/js/bootstrap.bundle.min';
   import 'jquery';
   import 'startbootstrap-sb-admin-2/js/sb-admin-2.min';

   // You can add custom JavaScript code here
   console.log("Hello from Webpack!");

This is the page where I like to use the SB Admin template
login.html

Below the structure of the project:
enter image description here

This is the result while loading login.html:
enter image description here

I am using:
Node v22.4.0
Npm 10.8.1
Docker version 19.03.8

Does anybody have an idea?
Thanks in advance

New contributor

Matteo Simone is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.

Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa Dịch vụ tổ chức sự kiện 5 sao Thông tin về chúng tôi Dịch vụ sinh nhật bé trai Dịch vụ sinh nhật bé gái Sự kiện trọn gói Các tiết mục giải trí Dịch vụ bổ trợ Tiệc cưới sang trọng Dịch vụ khai trương Tư vấn tổ chức sự kiện Hình ảnh sự kiện Cập nhật tin tức Liên hệ ngay Thuê chú hề chuyên nghiệp Tiệc tất niên cho công ty Trang trí tiệc cuối năm Tiệc tất niên độc đáo Sinh nhật bé Hải Đăng Sinh nhật đáng yêu bé Khánh Vân Sinh nhật sang trọng Bích Ngân Tiệc sinh nhật bé Thanh Trang Dịch vụ ông già Noel Xiếc thú vui nhộn Biểu diễn xiếc quay đĩa Dịch vụ tổ chức tiệc uy tín Khám phá dịch vụ của chúng tôi Tiệc sinh nhật cho bé trai Trang trí tiệc cho bé gái Gói sự kiện chuyên nghiệp Chương trình giải trí hấp dẫn Dịch vụ hỗ trợ sự kiện Trang trí tiệc cưới đẹp Khởi đầu thành công với khai trương Chuyên gia tư vấn sự kiện Xem ảnh các sự kiện đẹp Tin mới về sự kiện Kết nối với đội ngũ chuyên gia Chú hề vui nhộn cho tiệc sinh nhật Ý tưởng tiệc cuối năm Tất niên độc đáo Trang trí tiệc hiện đại Tổ chức sinh nhật cho Hải Đăng Sinh nhật độc quyền Khánh Vân Phong cách tiệc Bích Ngân Trang trí tiệc bé Thanh Trang Thuê dịch vụ ông già Noel chuyên nghiệp Xem xiếc khỉ đặc sắc Xiếc quay đĩa thú vị
Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa
Thiết kế website Thiết kế website Thiết kế website Cách kháng tài khoản quảng cáo Mua bán Fanpage Facebook Dịch vụ SEO Tổ chức sinh nhật