-
Notifications
You must be signed in to change notification settings - Fork 19
/
Copy pathDockerfile
49 lines (37 loc) · 1018 Bytes
/
Dockerfile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
# --- Builder Stage ---
FROM node:22-alpine AS builder
# Copy application files
COPY . /app
# Enable pnpm
RUN corepack enable pnpm
# Install and build frontend
WORKDIR /app/frontend
RUN pnpm install
RUN pnpm install dayjs # 漏了一个依赖
RUN pnpm build
# --- Final Stage ---
FROM alpine
# Environment variables
ENV HOST=0.0.0.0 \
FLASK_PORT=5000 \
WS_PORT=8765 \
FRONTEND_PORT=3000 \
TZ=Asia/Shanghai \
PYTHONDONTWRITEBYTECODE=1 \
PYTHONUNBUFFERED=1 \
JWT_SECRET_KEY=huohuo_email_secret_key
# Install Python
RUN apk add --no-cache py3-pip caddy bash
# Copy necessary files from builder stage
COPY --from=builder /app /app
# 显式复制启动脚本并设置权限
COPY docker-entrypoint.sh /app/
RUN chmod +x /app/docker-entrypoint.sh
# Set working directory
WORKDIR /app
# Install Python dependencies
RUN pip install --no-cache-dir -r requirements.txt --break-system-packages
# Expose port
EXPOSE 80
# Startup command
ENTRYPOINT ["/bin/bash", "/app/docker-entrypoint.sh"]