This commit is contained in:
@@ -17,8 +17,8 @@ jobs:
|
||||
username: ${{ secrets.USERNAME }}
|
||||
password: ${{ secrets.PASSWORD }}
|
||||
port: ${{ secrets.PORT }}
|
||||
timeout: 600s # 10 minutes total timeout
|
||||
command_timeout: 300s # 5 minutes per command timeout
|
||||
timeout: 900s # 15 minutes total timeout
|
||||
command_timeout: 600s # 10 minutes per command timeout
|
||||
script_stop_signal: true # Stop script on error
|
||||
script: |
|
||||
set -e
|
||||
@@ -36,7 +36,11 @@ jobs:
|
||||
|
||||
# 2. Build Backend
|
||||
echo "🏗️ Building Backend..."
|
||||
docker build -f backend/Dockerfile -t lcbp3-backend:latest .
|
||||
# Enable BuildKit for better caching and parallel builds
|
||||
DOCKER_BUILDKIT=1 docker build \
|
||||
--cache-from type=local,src=/tmp/.buildx-cache \
|
||||
--cache-to type=local,dest=/tmp/.buildx-cache \
|
||||
-f backend/Dockerfile -t lcbp3-backend:latest .
|
||||
|
||||
# 3. Build Frontend
|
||||
echo "🏗️ Building Frontend..."
|
||||
|
||||
+7
-3
@@ -49,7 +49,10 @@ RUN cd backend && \
|
||||
pnpm run build
|
||||
|
||||
# Deploy with production deps only (pnpm workspace isolation)
|
||||
RUN pnpm --filter backend deploy --prod --shamefully-hoist --legacy /app/backend-prod
|
||||
RUN pnpm --filter backend deploy --prod --shamefully-hoist --legacy /app/backend-prod \
|
||||
&& find /app/backend-prod/node_modules -name "*.md" -delete \
|
||||
&& find /app/backend-prod/node_modules -name "*.txt" -delete \
|
||||
&& find /app/backend-prod/node_modules -name "LICENSE*" -delete
|
||||
|
||||
# =========================
|
||||
# Stage 3: Production Runtime
|
||||
@@ -68,10 +71,11 @@ ENV NODE_ENV=production
|
||||
RUN addgroup -g 1001 -S nestjs && \
|
||||
adduser -S nestjs -u 1001
|
||||
|
||||
# Copy production artifacts only
|
||||
# Copy backend dist and node_modules (optimized)
|
||||
COPY --from=build --chown=nestjs:nestjs /app/backend/dist ./dist
|
||||
COPY --from=build --chown=nestjs:nestjs /app/backend-prod/node_modules ./node_modules
|
||||
COPY --from=build --chown=nestjs:nestjs /app/backend-prod/package.json ./
|
||||
# Copy node_modules with compression flag
|
||||
COPY --from=build --chown=nestjs:nestjs /app/backend-prod/node_modules ./node_modules
|
||||
|
||||
# Create uploads directory (Two-Phase Storage)
|
||||
RUN mkdir -p /app/uploads/temp /app/uploads/permanent && \
|
||||
|
||||
Reference in New Issue
Block a user