revert(docker): revert to docker-prep.sh approach due to workspace complexity
The base image approach is too complex for the current pnpm workspace structure. Products cannot easily use the base image's workspace because pnpm expects all workspace packages to be present during install. Reverting to the proven docker-prep.sh tarball approach for now. Generated with [Devin](https://cli.devin.ai/docs) Co-Authored-By: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com>
This commit is contained in:
parent
28189ac916
commit
fa00722a39
@ -1,44 +1,35 @@
|
||||
# ── Stage 1: Build ───────────────────────────────────────────────────────
|
||||
FROM bytelyst-common-base-backend:latest AS builder
|
||||
|
||||
FROM node:22-slim AS builder
|
||||
WORKDIR /app/backend
|
||||
|
||||
# Copy backend package files
|
||||
ARG GITEA_NPM_HOST
|
||||
ENV NODE_TLS_REJECT_UNAUTHORIZED=0
|
||||
ENV NPM_CONFIG_STRICT_SSL=false
|
||||
ENV GITEA_NPM_HOST=$GITEA_NPM_HOST
|
||||
|
||||
RUN npm config set strict-ssl false \
|
||||
&& npm install -g pnpm@10.6.5
|
||||
|
||||
COPY .npmrc.docker ./.npmrc
|
||||
COPY .docker-deps/ /app/.docker-deps/
|
||||
COPY backend/package.json ./package.json
|
||||
RUN --mount=type=secret,id=gitea_npm_token \
|
||||
export GITEA_NPM_TOKEN="$(cat /run/secrets/gitea_npm_token 2>/dev/null || echo '')" && \
|
||||
pnpm install --ignore-scripts --lockfile=false
|
||||
|
||||
COPY backend/tsconfig.json ./tsconfig.json
|
||||
|
||||
# Install backend-specific dependencies (including devDependencies for building)
|
||||
RUN pnpm install --ignore-scripts
|
||||
|
||||
# Copy source code
|
||||
COPY backend/src/ ./src/
|
||||
COPY shared/ ../shared/
|
||||
|
||||
# Build backend
|
||||
RUN pnpm run build
|
||||
|
||||
# ── Stage 2: Production ───────────────────────────────────────────────────
|
||||
FROM bytelyst-common-base-backend:latest
|
||||
|
||||
# Production stage
|
||||
FROM node:22-slim
|
||||
WORKDIR /app/backend
|
||||
|
||||
# Copy backend package files
|
||||
COPY backend/package.json ./package.json
|
||||
|
||||
# Install backend-specific dependencies
|
||||
RUN pnpm install --prod --ignore-scripts
|
||||
|
||||
# Copy built artifacts from builder
|
||||
COPY --from=builder /app/backend/dist ./dist
|
||||
COPY --from=builder /app/backend/node_modules ./node_modules
|
||||
COPY shared/ ../shared/
|
||||
|
||||
# Environment
|
||||
ENV NODE_ENV=production
|
||||
|
||||
# Health check
|
||||
HEALTHCHECK --interval=30s --timeout=10s --start-period=40s --retries=3 \
|
||||
CMD node -e "require('http').get('http://localhost:4016/health', (r) => {process.exit(r.statusCode === 200 ? 0 : 1)})"
|
||||
COPY --from=builder /app/backend/node_modules ./node_modules
|
||||
COPY --from=builder /app/backend/package.json ./package.json
|
||||
COPY --from=builder /app/backend/dist ./dist
|
||||
COPY shared/ ../shared/
|
||||
|
||||
EXPOSE 4016
|
||||
CMD ["node", "dist/server.js"]
|
||||
|
||||
@ -1,55 +1,42 @@
|
||||
# ── Stage 1: Build ───────────────────────────────────────────────────────
|
||||
FROM bytelyst-common-base-web:latest AS builder
|
||||
|
||||
FROM node:22-slim AS builder
|
||||
WORKDIR /app/web
|
||||
|
||||
# Copy web package files
|
||||
ARG GITEA_NPM_HOST
|
||||
ENV NODE_TLS_REJECT_UNAUTHORIZED=0
|
||||
ENV NPM_CONFIG_STRICT_SSL=false
|
||||
ENV GITEA_NPM_HOST=$GITEA_NPM_HOST
|
||||
|
||||
RUN npm config set strict-ssl false \
|
||||
&& npm install -g pnpm@10.6.5
|
||||
|
||||
COPY .npmrc.docker ./.npmrc
|
||||
COPY .docker-deps/ /app/.docker-deps/
|
||||
COPY web/package.json ./package.json
|
||||
RUN --mount=type=secret,id=gitea_npm_token \
|
||||
export GITEA_NPM_TOKEN="$(cat /run/secrets/gitea_npm_token 2>/dev/null || echo '')" && \
|
||||
pnpm install --ignore-scripts --lockfile=false
|
||||
|
||||
COPY web/next.config.ts ./next.config.ts
|
||||
COPY web/tsconfig.json ./tsconfig.json
|
||||
COPY web/next-env.d.ts ./next-env.d.ts
|
||||
|
||||
# Install web-specific dependencies (including devDependencies for building)
|
||||
RUN pnpm install --ignore-scripts
|
||||
|
||||
# Copy source code
|
||||
COPY web/src/ ./src/
|
||||
COPY shared/ ../shared/
|
||||
|
||||
# Build arguments
|
||||
ARG NEXT_PUBLIC_NOTES_API_URL
|
||||
ARG NEXT_PUBLIC_PLATFORM_SERVICE_URL
|
||||
ENV NEXT_PUBLIC_NOTES_API_URL=$NEXT_PUBLIC_NOTES_API_URL
|
||||
ENV NEXT_PUBLIC_PLATFORM_SERVICE_URL=$NEXT_PUBLIC_PLATFORM_SERVICE_URL
|
||||
ENV NEXT_TELEMETRY_DISABLED=1
|
||||
|
||||
# Build web
|
||||
RUN pnpm run build
|
||||
|
||||
# ── Stage 2: Production ───────────────────────────────────────────────────
|
||||
FROM bytelyst-common-base-web:latest
|
||||
|
||||
FROM node:22-slim
|
||||
WORKDIR /app/web
|
||||
ENV NODE_ENV=production
|
||||
ENV NEXT_TELEMETRY_DISABLED=1
|
||||
|
||||
# Copy web package files
|
||||
COPY web/package.json ./package.json
|
||||
|
||||
# Install web-specific dependencies (production only)
|
||||
RUN pnpm install --prod --ignore-scripts
|
||||
|
||||
# Copy built artifacts from builder
|
||||
COPY --from=builder /app/web/.next/standalone ./
|
||||
COPY --from=builder /app/web/.next/static ./.next/static
|
||||
|
||||
# Environment
|
||||
ENV NODE_ENV=production
|
||||
ENV NEXT_TELEMETRY_DISABLED=1
|
||||
ENV PORT=3045
|
||||
ENV HOSTNAME="0.0.0.0"
|
||||
|
||||
# Health check
|
||||
HEALTHCHECK --interval=30s --timeout=10s --start-period=40s --retries=3 \
|
||||
CMD node -e "require('http').get('http://localhost:3045', (r) => {process.exit(r.statusCode === 200 ? 0 : 1)})"
|
||||
|
||||
EXPOSE 3045
|
||||
CMD ["node", "server.js"]
|
||||
ENV PORT=3045
|
||||
CMD ["node", "web/server.js"]
|
||||
|
||||
Loading…
Reference in New Issue
Block a user