Skip to content

Commit

Permalink
chore: update Dockerfile
Browse files Browse the repository at this point in the history
  • Loading branch information
byodian committed Dec 19, 2024
1 parent 08379bf commit 9a56987
Show file tree
Hide file tree
Showing 7 changed files with 387 additions and 298 deletions.
16 changes: 16 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
.git
.gitignore
*.md
*.log
dist
Dockerfile
.dockerignore
.next
LICENSE
docs
.github

.husky
node_modules
tests
coverage
35 changes: 35 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
# Base image with pnpm pre-installed
FROM node:20-alpine AS base
ENV PNPM_HOME="/pnpm"
ENV PATH="$PNPM_HOME:$PATH"
WORKDIR /app
RUN npm install -g pnpm

# Production dependencies stage
FROM base AS prod-deps
WORKDIR /app
COPY package.json pnpm-lock.yaml ./
RUN --mount=type=cache,id=pnpm,target=/pnpm/store pnpm install --prod --frozen-lockfile --ignore-scripts

# Build stage
FROM base AS build
WORKDIR /app
COPY package.json pnpm-lock.yaml ./
RUN --mount=type=cache,id=pnpm,target=/pnpm/store pnpm install --frozen-lockfile
COPY . .
RUN pnpm run build

# Final image (minimal size)
FROM base AS final
WORKDIR /app

# Copy only the necessary files from previous stages
COPY --from=prod-deps /app/node_modules ./node_modules
COPY --from=build /app/.next ./.next
COPY package.json pnpm-lock.yaml ./
COPY public ./public

EXPOSE 3000

# Set the entry point for production
CMD [ "pnpm", "start" ]
20 changes: 0 additions & 20 deletions Dockerfile.yaml

This file was deleted.

8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ https://github.com/user-attachments/assets/d12a1009-a27a-4dae-a2e5-727f3b982e3b

## 技术栈
- **前端**: Next.js、tiptap 编辑器、tailwindcss、shadcn/ui
- **图片处理**html-to-image, UPNG
- **图片处理**html2canvas, UPNG
- **数据库**:IndexedDB (本地存储)

## 快速开始
Expand All @@ -54,7 +54,7 @@ pnpm dev
docker run -d -t -p 3000:3000 \
--name=oneimg \
--restart=always \
swr.ap-southeast-1.myhuaweicloud.com/wenyang0/oneimg:latest
bydian/oneimg:latest

```

Expand All @@ -66,12 +66,12 @@ git clone https://github.com/byodian/oneimg.git

#docker 编译
cd oneimg/
docker build -t oneimg:v1 -f Dockerfile.yaml .
docker build -t oneimg:v1 .

#启动服务
docker run -d -t -p 3000:3000 --name oneimg --restart=always oneimg:v1
```
最后,打开你的浏览器访问服务的地址 http://serverIP:3000 即可
最后打开你的浏览器访问服务的地址 http://localhost:3000 即可

## 使用方法
1. 打开应用后,首先创建主题
Expand Down
14 changes: 5 additions & 9 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,10 @@
"release": "bumpp -r"
},
"dependencies": {
"@byodian/eslint-config-react": "^0.1.6",
"@dnd-kit/core": "^6.1.0",
"@dnd-kit/modifiers": "^7.0.0",
"@dnd-kit/sortable": "^8.0.0",
"@dnd-kit/utilities": "^3.2.2",
"@emotion/react": "^11.13.3",
"@hookform/resolvers": "^3.9.0",
"@pdf-lib/upng": "^1.0.1",
"@radix-ui/react-dialog": "^1.1.1",
Expand Down Expand Up @@ -52,25 +50,18 @@
"@tiptap/extension-underline": "^2.6.4",
"@tiptap/pm": "^2.6.6",
"@tiptap/react": "^2.6.4",
"@types/dompurify": "^3.0.5",
"@types/file-saver": "^2.0.7",
"@types/upng-js": "^2.1.5",
"bumpp": "^9.7.1",
"class-variance-authority": "^0.7.0",
"clsx": "^2.1.1",
"dompurify": "^3.1.6",
"embla-carousel-react": "^8.2.0",
"exifreader": "^4.23.3",
"file-saver": "^2.0.5",
"html-react-parser": "^5.1.12",
"html-to-image": "^1.11.11",
"html2canvas": "^1.4.1",
"html2canvas-pro": "^1.5.8",
"jszip": "^3.10.1",
"lucide": "^0.428.0",
"lucide-react": "^0.428.0",
"next": "14.2.5",
"next-themes": "^0.3.0",
"png-metadata": "^1.0.2",
"react": "^18.3.1",
"react-dom": "^18",
Expand All @@ -82,10 +73,15 @@
"zustand": "5.0.0-rc.2"
},
"devDependencies": {
"@byodian/eslint-config-react": "^0.1.6",
"@cloudflare/next-on-pages": "^1.13.2",
"@types/dompurify": "^3.0.5",
"@types/file-saver": "^2.0.7",
"@types/node": "^20",
"@types/react": "^18",
"@types/react-dom": "^18",
"@types/upng-js": "^2.1.5",
"bumpp": "^9.7.1",
"eslint": "^8",
"eslint-config-next": "14.2.5",
"husky": "^9.1.6",
Expand Down
Loading

0 comments on commit 9a56987

Please sign in to comment.