Skip to content

Commit 2917c49

Browse files
committed
🚀 Modify config to optimize image size
1 parent 4caca1f commit 2917c49

File tree

6 files changed

+34
-23
lines changed

6 files changed

+34
-23
lines changed

.dockerignore

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,24 @@
11
node_modules
2+
pnpm-lock.yaml
23

34
client
5+
server
6+
7+
!server/package.json
8+
!server/dist
9+
!server/public
410

511
*.log
612
*.sqlite
713

14+
.git
15+
.gitignore
16+
.DS_Store
17+
*.sh
18+
19+
**/*.ts
20+
821
Dockerfile
9-
docker-compose.yml
22+
docker-compose.yml
23+
24+
LICENSE

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ client/.routify
1212
server/public
1313

1414
# Datebase
15+
server/dist
1516
server/data/*.sqlite
1617

1718
# local env files

Dockerfile

Lines changed: 13 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,22 @@
1-
# 使用官方 Node.js 镜像
2-
FROM node:20.5.1-alpine
1+
# Use the official Node.js image
2+
FROM node:lts-alpine3.20
33

4-
# 全局安装 tsx
5-
RUN npm install -g tsx
6-
7-
# 设置工作目录
4+
# Set WORKDIR
85
WORKDIR /app
96

10-
# 复制 package.json 文件
11-
COPY ./server/package.json ./
12-
13-
# 安装生产依赖
14-
RUN npm install
7+
# Install server side dependencies
8+
COPY ./server/package.json /app
9+
RUN npm i --only=production
1510

16-
# 复制 server 代码到工作目录
17-
COPY ./server /app/server
11+
# Copy server side code to WORKDIR
12+
COPY ./server/dist /app/dist
13+
COPY ./server/public /app/public
1814

19-
# 暴露应用的端口
15+
# Expose app port
2016
EXPOSE 8888
2117

22-
# 定义数据库文件路径
18+
# Define database file path
2319
VOLUME ["/app/data"]
2420

25-
# 启动后端服务
26-
WORKDIR /app
27-
CMD ["npx", "tsx", "server/src/index.ts"]
21+
# Auto exec Node.js APP
22+
CMD ["node", "dist/index.js"]

docker-compose.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ version: '3.8'
22

33
services:
44
wealth-tracker:
5-
image: wealth-tracker
5+
image: nicejade/wealth-tracker
66
container_name: wealth-tracker
77
ports:
88
- '8888:8888'

package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
{
22
"name": "wealth-tracker",
33
"description": "生财有迹(Wealth Tracker)是一款专注于个人资产分析的应用程序。其核心功能是:全面记录并展示用户的资产状况,帮助用户清晰地了解财务现状;结合每种资产的特性和当前经济环境,利用 AI 技术进行分析,并提供适宜的财务建议。",
4-
"version": "1.0.0",
4+
"version": "1.1.0",
55
"scripts": {
6-
"prettier": "prettier --write \"{client,server}/**/**/*.{svelte,js,ts,jsx,tsx,css,scss,vue}\""
6+
"prettier": "prettier --write \"{client,server}/**/**/*.{svelte,js,ts,jsx,tsx,css,scss}\""
77
},
88
"husky": {
99
"hooks": {

server/tsconfig.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"compilerOptions": {
3-
"target": "es5",
3+
"target": "es6",
44
"module": "commonjs",
55
"outDir": "./dist",
66
"sourceMap": false,

0 commit comments

Comments
 (0)