mirror of
https://github.com/RealKai42/qwerty-learner.git
synced 2026-04-05 14:29:04 +08:00
chore: docker compose deployment (#771)
* chore: docker compose deployment * build: code clean * build: node18 update to node20
This commit is contained in:
@@ -1,14 +1,11 @@
|
|||||||
FROM node:18 AS build
|
FROM node:20 AS build
|
||||||
|
|
||||||
# 设置工作目录
|
# 设置工作目录
|
||||||
WORKDIR /app
|
WORKDIR /app
|
||||||
|
|
||||||
COPY package*.json ./
|
|
||||||
|
|
||||||
RUN npm install
|
|
||||||
|
|
||||||
COPY . .
|
COPY . .
|
||||||
|
RUN npm config set registry https://registry.npmmirror.com
|
||||||
|
RUN npm install
|
||||||
RUN npm run build
|
RUN npm run build
|
||||||
|
|
||||||
# 将构建好的 React 应用复制到 Nginx 容器的默认站点目录
|
# 将构建好的 React 应用复制到 Nginx 容器的默认站点目录
|
||||||
|
|||||||
@@ -2,28 +2,8 @@ version: '3'
|
|||||||
|
|
||||||
services:
|
services:
|
||||||
qwertylearner:
|
qwertylearner:
|
||||||
image: 'node:16'
|
build:
|
||||||
user: 'root'
|
context: .
|
||||||
working_dir: '/app/qwerty-learner'
|
dockerfile: Dockerfile
|
||||||
ports: [8990:5173]
|
ports:
|
||||||
volumes:
|
- '8990:5173'
|
||||||
- $PWD/:/app/qwerty-learner
|
|
||||||
command:
|
|
||||||
- /bin/sh
|
|
||||||
- -c
|
|
||||||
- |
|
|
||||||
echo 'run the bash command..'
|
|
||||||
npm -v
|
|
||||||
npm config set registry https://registry.npm.taobao.org
|
|
||||||
npm install -g yarn
|
|
||||||
cd /app/qwerty-learner
|
|
||||||
yarn install
|
|
||||||
yarn build
|
|
||||||
nohup yarn start --host=0.0.0.0 &
|
|
||||||
echo 'success.. start..'
|
|
||||||
pwd
|
|
||||||
echo '查看输出:...'
|
|
||||||
cat nohup.out
|
|
||||||
tail -f /dev/null
|
|
||||||
tty: true
|
|
||||||
stdin_open: true
|
|
||||||
Reference in New Issue
Block a user