Skip to content

Commit

Permalink
更新注释和docker-compose.yml (#541)
Browse files Browse the repository at this point in the history
* 更新注释

* fix: 修复通过docker-compose启动项目无法登录的问题

* 优化docker-compsoe配置文件

* 按机器人建议优化

* update docker-composer.yml
  • Loading branch information
jujijigo authored Feb 12, 2025
1 parent 85f06a2 commit 4c88e0e
Show file tree
Hide file tree
Showing 2 changed files with 53 additions and 25 deletions.
72 changes: 50 additions & 22 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -1,29 +1,57 @@
version: '3'
name: MineAdmin

volumes:
mine_redis_data:
mine_mysql_data:

services:
hyperf:
build:
dockerfile: Dockerfile
context: .
restart: always
environment:
- "TIMEZONE=Asia/Shanghai"
- "APP_NAME=MineAdmin"
working_dir: "/opt/www"
redis:
image: redis:7.2-alpine
ports:
- "6379:6379"
volumes:
- ./:/opt/www
entrypoint: ["php", "watch", "-c"]
- mine_redis_data:/data
command: redis-server --appendonly yes
deploy:
resources:
limits:
memory: 1G
healthcheck:
test: ["CMD", "redis-cli", "ping"]
interval: 10s
timeout: 5s
retries: 3
environment:
- TZ=Asia/Shanghai

mysql:
image: mysql:5.7
restart: always
volumes:
- mine_mysql_data:/var/lib/mysql
ports:
- "3306:3306"
command: --default-authentication-plugin=mysql_native_password
environment:
MYSQL_ROOT_PASSWORD: root
MYSQL_DATABASE: mineadmin
redis:
image: redis:alpine
restart: always
frontend:
build:
context: ./web
args:
MINE_NODE_ENV: production
restart: always
MYSQL_CHARACTER_SET_SERVER: utf8mb4
MYSQL_COLLATION_SERVER: utf8mb4_unicode_ci
TZ: Asia/Shanghai

hyperf:
image: hyperf/hyperf:8.1-alpine-v3.18-swoole
volumes:
- ./:/www/MineAdmin
working_dir: /www/MineAdmin
ports:
- "9501:9501"
- "9503:9503"
environment:
- TZ=Asia/Shanghai
- APP_NAME=MineAdmin
command:
- sh
- -c
- |
ln -sf /usr/share/zoneinfo/Asia/Shanghai /etc/localtime
tail -F /dev/null
6 changes: 3 additions & 3 deletions web/vite.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import pkg from './package.json'
import createVitePlugins from './vite'
import { exclude, include } from './vite/optimize'

// https://vitejs.dev/config/
// https://cn.vite.dev/config/
export default async ({ mode, command }) => {
const env = loadEnv(mode, process.cwd())
function isProduction(): boolean {
Expand All @@ -24,7 +24,7 @@ export default async ({ mode, command }) => {
const proxyPrefix = env.VITE_PROXY_PREFIX
return defineConfig({
base: env.VITE_APP_ROOT_BASE,
// 开发服务器选项 https://cn.vitejs.dev/config/#server-options
// 开发服务器选项 https://cn.vite.dev/config/#server-options
server: {
open: true,
port: Number(env.VITE_APP_PORT ?? process.env.port),
Expand All @@ -39,7 +39,7 @@ export default async ({ mode, command }) => {
esbuild: {
drop: isProduction() ? ['console', 'debugger'] : [],
},
// 构建选项 https://cn.vitejs.dev/config/#server-fsserve-root
// 构建选项 https://cn.vite.dev/config/#server-fsserve-root
build: {
outDir: isProduction ? 'dist' : `dist-${mode}`,
sourcemap: env.VITE_BUILD_SOURCEMAP === 'true',
Expand Down

0 comments on commit 4c88e0e

Please sign in to comment.