eruda-code / Dockerfile
soiz1's picture
Update Dockerfile
77b3a2a verified
raw
history blame contribute delete
778 Bytes
# 1. Nodeでビルド
FROM node:18-alpine AS builder
RUN apk add --no-cache git python3 make g++ bash findutils
WORKDIR /app
COPY . .
RUN npm install @babel/runtime --save
RUN npm ci --no-audit --no-fund || npm install --no-audit --no-fund
RUN npm run build
RUN mkdir -p /build_output \
&& FILE=$(find . -type f -name "eruda-code*.js" | grep -E "dist|build|lib|^\./eruda-code" | head -n1) \
&& if [ -z "$FILE" ]; then echo "ビルド成果物が見つかりません"; exit 1; fi \
&& cp "$FILE" /build_output/eruda-code.js
# 2. Python + Flask のランタイム
FROM python:3.11-slim
RUN pip install --no-cache-dir flask
WORKDIR /app
COPY --from=builder /build_output/eruda-code.js /app/static/eruda-code.js
COPY app.py /app/app.py
EXPOSE 7860
CMD ["python", "app.py"]