【开源电商网站】(2),使用docker-compose和dockerfile进行配置,设置自定义的镜像,安装插件,增加汉化包,支持中文界面汉化。

本文主要是介绍【开源电商网站】(2),使用docker-compose和dockerfile进行配置,设置自定义的镜像,安装插件,增加汉化包,支持中文界面汉化。,希望对大家解决编程问题提供一定的参考价值,需要的开发者们随着小编来一起学习吧!

项目相关代代码地址

相关内容:
https://blog.csdn.net/freewebsys/category_12461196.html

原文地址:
https://blog.csdn.net/freewebsys/article/details/133666433

包括以下运行的详细代码:
https://gitee.com/study-demo-all/oscommerce2-study

视频教程:

https://www.bilibili.com/video/BV1kB4y1Z7HS/?vd_source=4b290247452adda4e56d84b659b0c8a2

1,使用dockerfile进行构建

首先是镜像的选择,统一使用debian的基础镜像,库安装方便。同时镜像也比较小。
常用的命令也非常熟悉。

相关的debian版本:

Debian 11 “Bullseye” To be defined: roughly July 2024 to June 2026

https://wiki.debian.org/LTS
在这里插入图片描述

2,然后就使用到了docker-compose的 build 命令

build: ./dir 是个文件夹
里面需要有个文件叫 Dockerfile, 才可以。

对于php-fpm来说是:

############### 使用 php:7-fpm 版本 ###############php-fpm:restart: alwaysbuild: ./php-fpm-bullseye-mysqlimage: php-fpm-bullseye-mysqlcontainer_name: php-fpm

其中需要使用 php7会有一些警告。配置下就可以。
但是php8 不能运行了一个函数报错了:


Fatal error: Uncaught Error: Call to undefined function get_magic_quotes_gpc() in /var/www/html/includes/functions/compatibility.php:46 Stack trace: #0 /var/www/html/includes/application_top.php(41): require() #1 /var/www/html/index.php(13): require('/var/www/html/i...') #2 {main} thrown in /var/www/html/includes/functions/compatibility.php on line 46

可以安装成功,但是不能运行。
The PHP function get_magic_quotes_gpc() was deprecated in PHP 7.4 and removed in PHP 8.

也就是最高的版本就是 php7 才可以运行osc项目。

3,其中的dockerfile

# 只能使用最新的 PHP7 版本
FROM php:7-fpm-bullseyeRUN sed -i "s/deb.debian.org/mirrors.aliyun.com/g" /etc/apt/sources.list &&  apt update && \apt -y install wget libwebp-dev libjpeg-dev libpng-dev libfreetype6-dev libc-client-dev libkrb5-dev libzip-dev && \docker-php-ext-configure gd --with-jpeg=/usr/include --with-freetype=/usr/include/ && \docker-php-ext-install gd && docker-php-ext-enable gd && \docker-php-ext-install mysqli && docker-php-ext-enable mysqli && apt clean 

然后执行执行 docker-compose up -d 就可以同时构建镜像,然后再运行。

本地就会有个镜像:

$ docker images 
REPOSITORY                         TAG              IMAGE ID       CREATED         SIZE
php-fpm-bullseye-mysql             latest           8c83373ac361   9 hours ago     491MB

4,最后启动成功了

在这里插入图片描述

5,完整的docker-compose文件:

## 启动命令:
## docker-compose up -d -f docker-compose-mysql.ymlversion: "3"
services:################## mysql 数据库 5.7 版本 ##################mysql-osc:restart: alwaysimage: mysql:5.7container_name: mysql-oscports:- "3306:3306"volumes:- "./data/mysql/data:/var/lib/mysql"- "./mysql/mysql.cnf:/etc/mysql/conf.d/mysql.cnf"#- "./mysql/init.sql:/docker-entrypoint-initdb.d/init.sql"- "./mysql/connDB.sh:/connDB.sh"environment:MYSQL_ROOT_PASSWORD: mysqloscMYSQL_DATABASE: oscTZ: Asia/Shanghaicommand: ['--character-set-server=utf8mb4','--collation-server=utf8mb4_general_ci','--max_connections=3000']############### 使用 php:7-fpm 版本 ###############php-fpm:restart: alwaysbuild: ./php-fpm-bullseye-mysqlimage: php-fpm-bullseye-mysqlcontainer_name: php-fpmports:- "9000:9000"volumes:- "./oscommerce2-2.3.4/catalog:/var/www/html"- "./php/php-fpm.conf:/usr/local/etc/php-fpm.conf"links:- mysql-osc:mysql-osc############### 使用 nginx 版本 ###############nginx-osc:restart: alwaysimage: nginx:bullseyecontainer_name: nginx-oscports:- "8080:8080"volumes:- "./oscommerce2-2.3.4/catalog:/var/www/html"- "./data/nginx/logs:/data/logs"- "./nginx/nginx.conf:/etc/nginx/conf.d/default.conf"links:- php-fpm:php-fpm

6,汉化包

版本虽然古老但是也是支持汉化的。
也可以搜索到相关的汉化包:

汉化后的效果:
在这里插入图片描述
解压缩安装到admin目录下面:
然后就是增加配置,发现需要增加类目和产品描述,否则产品也不展示:

2 代表是中文数据,插入结算货币和语言:


INSERT INTO currencies VALUES (3,'Chinese RMB','CNY','¥','','.',',','2','1.0000', now());
INSERT INTO languages VALUES (2,'简体中文','cn','icon.gif','chinese',0);INSERT INTO categories_description VALUES ( '1', '2', '硬件');
INSERT INTO categories_description VALUES ( '2', '2', '软件');
INSERT INTO categories_description VALUES ( '3', '2', 'DVD电影');
INSERT INTO categories_description VALUES ( '4', '2', '显卡');
INSERT INTO categories_description VALUES ( '5', '2', '打印机');
INSERT INTO categories_description VALUES ( '6', '2', '显示器');
INSERT INTO categories_description VALUES ( '7', '2', '扬声器');
INSERT INTO categories_description VALUES ( '8', '2', '键盘');
INSERT INTO categories_description VALUES ( '9', '2', '鼠标');
INSERT INTO categories_description VALUES ( '10', '2', '动作');
INSERT INTO categories_description VALUES ( '11', '2', '科幻');
INSERT INTO categories_description VALUES ( '12', '2', '喜剧');
INSERT INTO categories_description VALUES ( '13', '2', '卡通');
INSERT INTO categories_description VALUES ( '14', '2', '惊悚');
INSERT INTO categories_description VALUES ( '15', '2', '戏剧');
INSERT INTO categories_description VALUES ( '16', '2', '内存');
INSERT INTO categories_description VALUES ( '17', '2', 'CD-ROM 驱动器');
INSERT INTO categories_description VALUES ( '18', '2', '模拟');
INSERT INTO categories_description VALUES ( '19', '2', '动作');
INSERT INTO categories_description VALUES ( '20', '2', '策略');
INSERT INTO categories_description VALUES ( '21', '2', '配件');INSERT INTO products_description VALUES (1,2,'Matrox G200 MMS','加强了其在多监视器领域的领先地位,Matrox Graphics Inc.再次开发出业界最灵活、最先进的解决方案。向您介绍新的 Matrox G200 多监视器系列;首款支持单个 8 英寸 PCI 主板上最多四个 DVI 数字平板显示器的显卡。随着金融工作场所对数字平板显示器的需求不断增长,Matrox G200 MMS 成为灵活解决方案的终极选择。Matrox G200 MMS 还支持数字显示工作组(DDWG)创建的新数字视频接口(DVI),旨在促进数字平板显示器的采用。其他配置包括复合视频捕获能力和内置电视调谐器,使 Matrox G200 MMS 成为满足商务需求的完整解决方案。基于获奖的 MGA-G200 图形芯片,Matrox G200多监视器系列提供卓越的2D/3D图形加速功能,满足诸如实时股票报价(Versus)、实时视频流(Reuters 和 Bloombergs)、多个窗口应用程序、文字处理、电子表格以及 CAD 等商务应用的需求。','www.matrox.com/mga/products/g200_mms/home.cfm',0);
INSERT INTO products_description VALUES (2,2,'Matrox G400 32MB','<strong>Dramatically Different High Performance Graphics</strong><br /><br />Introducing the Millennium G400 Series - a dramatically different, high performance graphics experience. Armed with the industry\'s fastest graphics chip, the Millennium G400 Series takes explosive acceleration two steps further by adding unprecedented image quality, along with the most versatile display options for all your 3D, 2D and DVD applications. As the most powerful and innovative tools in your PC\'s arsenal, the Millennium G400 Series will not only change the way you see graphics, but will revolutionize the way you use your computer.<br /><br /><strong>Key features:</strong><ul><li>New Matrox G400 256-bit DualBus graphics chip</li><li>Explosive 3D, 2D and DVD performance</li><li>DualHead Display</li><li>Superior DVD and TV output</li><li>3D Environment-Mapped Bump Mapping</li><li>Vibrant Color Quality rendering </li><li>UltraSharp DAC of up to 360 MHz</li><li>3D Rendering Array Processor</li><li>Support for 16 or 32 MB of memory</li></ul>','www.matrox.com/mga/products/mill_g400/home.htm',0);
....

也就是 categories_description products_description 类目和产品描述都需要输入英文信息才可以。
只是翻译了第一条数据,其他的数据没有翻译,直接拷贝的才可以。

效果是:

在这里插入图片描述

7,总结

汉化的入口在语言上面:

在这里插入图片描述
然后就可以切换英文和中文信息了。

这篇关于【开源电商网站】(2),使用docker-compose和dockerfile进行配置,设置自定义的镜像,安装插件,增加汉化包,支持中文界面汉化。的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!



http://www.chinasem.cn/article/190927

相关文章

Python使用Tenacity一行代码实现自动重试详解

《Python使用Tenacity一行代码实现自动重试详解》tenacity是一个专为Python设计的通用重试库,它的核心理念就是用简单、清晰的方式,为任何可能失败的操作添加重试能力,下面我们就来看... 目录一切始于一个简单的 API 调用Tenacity 入门:一行代码实现优雅重试精细控制:让重试按我

Python安装Pandas库的两种方法

《Python安装Pandas库的两种方法》本文介绍了三种安装PythonPandas库的方法,通过cmd命令行安装并解决版本冲突,手动下载whl文件安装,更换国内镜像源加速下载,最后建议用pipli... 目录方法一:cmd命令行执行pip install pandas方法二:找到pandas下载库,然后

MySQL中EXISTS与IN用法使用与对比分析

《MySQL中EXISTS与IN用法使用与对比分析》在MySQL中,EXISTS和IN都用于子查询中根据另一个查询的结果来过滤主查询的记录,本文将基于工作原理、效率和应用场景进行全面对比... 目录一、基本用法详解1. IN 运算符2. EXISTS 运算符二、EXISTS 与 IN 的选择策略三、性能对比

SpringBoot多环境配置数据读取方式

《SpringBoot多环境配置数据读取方式》SpringBoot通过环境隔离机制,支持properties/yaml/yml多格式配置,结合@Value、Environment和@Configura... 目录一、多环境配置的核心思路二、3种配置文件格式详解2.1 properties格式(传统格式)1.

使用Python构建智能BAT文件生成器的完美解决方案

《使用Python构建智能BAT文件生成器的完美解决方案》这篇文章主要为大家详细介绍了如何使用wxPython构建一个智能的BAT文件生成器,它不仅能够为Python脚本生成启动脚本,还提供了完整的文... 目录引言运行效果图项目背景与需求分析核心需求技术选型核心功能实现1. 数据库设计2. 界面布局设计3

使用IDEA部署Docker应用指南分享

《使用IDEA部署Docker应用指南分享》本文介绍了使用IDEA部署Docker应用的四步流程:创建Dockerfile、配置IDEADocker连接、设置运行调试环境、构建运行镜像,并强调需准备本... 目录一、创建 dockerfile 配置文件二、配置 IDEA 的 Docker 连接三、配置 Do

Android Paging 分页加载库使用实践

《AndroidPaging分页加载库使用实践》AndroidPaging库是Jetpack组件的一部分,它提供了一套完整的解决方案来处理大型数据集的分页加载,本文将深入探讨Paging库... 目录前言一、Paging 库概述二、Paging 3 核心组件1. PagingSource2. Pager3.

Python进行JSON和Excel文件转换处理指南

《Python进行JSON和Excel文件转换处理指南》在数据交换与系统集成中,JSON与Excel是两种极为常见的数据格式,本文将介绍如何使用Python实现将JSON转换为格式化的Excel文件,... 目录将 jsON 导入为格式化 Excel将 Excel 导出为结构化 JSON处理嵌套 JSON:

python设置环境变量路径实现过程

《python设置环境变量路径实现过程》本文介绍设置Python路径的多种方法:临时设置(Windows用`set`,Linux/macOS用`export`)、永久设置(系统属性或shell配置文件... 目录设置python路径的方法临时设置环境变量(适用于当前会话)永久设置环境变量(Windows系统

python使用try函数详解

《python使用try函数详解》Pythontry语句用于异常处理,支持捕获特定/多种异常、else/final子句确保资源释放,结合with语句自动清理,可自定义异常及嵌套结构,灵活应对错误场景... 目录try 函数的基本语法捕获特定异常捕获多个异常使用 else 子句使用 finally 子句捕获所