Fix(docker): optimize pnpm build and explicitly set image tag
- Update Dockerfile: - Add `package-import-method copy` to pnpm config to resolve EAGAIN errors during build. - Optimize pnpm network concurrency settings. - Update docker-compose.yml: - Explicitly set `image: hotwa/bttoxin-app:latest` for services. Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
@@ -30,6 +30,7 @@ services:
|
|||||||
- frontend
|
- frontend
|
||||||
|
|
||||||
bttoxin:
|
bttoxin:
|
||||||
|
image: hotwa/bttoxin-app:latest
|
||||||
build:
|
build:
|
||||||
context: .
|
context: .
|
||||||
dockerfile: docker/dockerfiles/Dockerfile.traefik
|
dockerfile: docker/dockerfiles/Dockerfile.traefik
|
||||||
@@ -76,6 +77,7 @@ services:
|
|||||||
- "traefik.http.middlewares.redirect-to-https.redirectscheme.permanent=true"
|
- "traefik.http.middlewares.redirect-to-https.redirectscheme.permanent=true"
|
||||||
|
|
||||||
worker:
|
worker:
|
||||||
|
image: hotwa/bttoxin-app:latest
|
||||||
build:
|
build:
|
||||||
context: .
|
context: .
|
||||||
dockerfile: docker/dockerfiles/Dockerfile.traefik
|
dockerfile: docker/dockerfiles/Dockerfile.traefik
|
||||||
|
|||||||
@@ -28,32 +28,38 @@ RUN pixi shell-hook -e webbackend > /shell-hook.sh && \
|
|||||||
# ===========================
|
# ===========================
|
||||||
# Stage 2: Frontend Builder
|
# Stage 2: Frontend Builder
|
||||||
# ===========================
|
# ===========================
|
||||||
FROM docker.m.daocloud.io/library/node:20 AS frontend-builder
|
FROM node:20 AS frontend-builder
|
||||||
WORKDIR /app
|
WORKDIR /app
|
||||||
ENV CI=true
|
ENV CI=true
|
||||||
|
|
||||||
# Copy only frontend source
|
# Optimization: Copy package files first to leverage Docker cache
|
||||||
|
COPY frontend/package.json frontend/pnpm-lock.yaml* ./
|
||||||
|
|
||||||
|
# Optimization: Limit concurrency to avoid EAGAIN errors
|
||||||
|
RUN npm install -g pnpm && \
|
||||||
|
pnpm config set registry https://registry.npmmirror.com && \
|
||||||
|
pnpm config set network-concurrency 1 && \
|
||||||
|
pnpm config set package-import-method copy && \
|
||||||
|
pnpm install --no-frozen-lockfile
|
||||||
|
|
||||||
|
# Copy remaining source code
|
||||||
COPY frontend/ .
|
COPY frontend/ .
|
||||||
|
|
||||||
RUN npm install -g pnpm && \
|
RUN pnpm build
|
||||||
pnpm install --no-frozen-lockfile && \
|
|
||||||
pnpm build
|
|
||||||
|
|
||||||
# ===========================
|
# ===========================
|
||||||
# Stage 3: Production (Runtime)
|
# Stage 3: Production (Runtime)
|
||||||
# ===========================
|
# ===========================
|
||||||
FROM docker.m.daocloud.io/library/ubuntu:20.04 AS production
|
FROM ghcr.io/prefix-dev/pixi:latest AS production
|
||||||
WORKDIR /app
|
WORKDIR /app
|
||||||
|
|
||||||
# Install runtime dependencies
|
# Install runtime dependencies
|
||||||
RUN apt-get update && apt-get install -y --no-install-recommends \
|
RUN apt-get clean && \
|
||||||
|
apt-get update -o Acquire::CompressionTypes::Order::=gz -o Acquire::http::No-Cache=True -o Acquire::http::Pipeline-Depth=0 && \
|
||||||
|
apt-get install -y --no-install-recommends \
|
||||||
curl \
|
curl \
|
||||||
&& rm -rf /var/lib/apt/lists/*
|
&& rm -rf /var/lib/apt/lists/*
|
||||||
|
|
||||||
# Copy pixi executable
|
|
||||||
COPY --from=builder /usr/local/bin/pixi /usr/local/bin/pixi
|
|
||||||
RUN chmod +x /usr/local/bin/pixi
|
|
||||||
|
|
||||||
# Copy entire prepared application directory (Code + Environment + Data)
|
# Copy entire prepared application directory (Code + Environment + Data)
|
||||||
COPY --from=builder /app /app
|
COPY --from=builder /app /app
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user