Spaces:
Sleeping
Sleeping
Create Dockerfile
Browse files- Dockerfile +26 -0
Dockerfile
ADDED
|
@@ -0,0 +1,26 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# 1. Nodeでビルド
|
| 2 |
+
FROM node:18-alpine AS builder
|
| 3 |
+
|
| 4 |
+
RUN apk add --no-cache git python3 make g++ bash findutils
|
| 5 |
+
WORKDIR /app
|
| 6 |
+
COPY . .
|
| 7 |
+
RUN npm install @babel/runtime --save
|
| 8 |
+
|
| 9 |
+
RUN npm ci --no-audit --no-fund || npm install --no-audit --no-fund
|
| 10 |
+
RUN npm run build
|
| 11 |
+
|
| 12 |
+
RUN mkdir -p /build_output \
|
| 13 |
+
&& FILE=$(find . -type f -name "eruda-features*.js" | grep -E "dist|build|lib|^\./eruda-features" | head -n1) \
|
| 14 |
+
&& if [ -z "$FILE" ]; then echo "ビルド成果物が見つかりません"; exit 1; fi \
|
| 15 |
+
&& cp "$FILE" /build_output/eruda-features.js
|
| 16 |
+
|
| 17 |
+
# 2. Python + Flask のランタイム
|
| 18 |
+
FROM python:3.11-slim
|
| 19 |
+
RUN pip install --no-cache-dir flask
|
| 20 |
+
WORKDIR /app
|
| 21 |
+
|
| 22 |
+
COPY --from=builder /build_output/eruda-features.js /app/static/eruda-features.js
|
| 23 |
+
COPY app.py /app/app.py
|
| 24 |
+
|
| 25 |
+
EXPOSE 7860
|
| 26 |
+
CMD ["python", "app.py"]
|