59 lines
1.5 KiB
Docker
59 lines
1.5 KiB
Docker
# Frontend build stage
|
|
FROM containers.global.bsf.tools/node:20-alpine AS frontend-builder
|
|
|
|
ARG NPM_REGISTRY=https://deps.global.bsf.tools/artifactory/api/npm/registry.npmjs.org/
|
|
|
|
WORKDIR /app/frontend
|
|
|
|
# Configure npm registry if provided
|
|
RUN if [ -n "$NPM_REGISTRY" ]; then npm config set registry "$NPM_REGISTRY"; fi
|
|
|
|
# Copy package files
|
|
COPY frontend/package*.json ./
|
|
RUN npm install
|
|
|
|
# Copy frontend source
|
|
COPY frontend/ ./
|
|
|
|
# Build frontend
|
|
RUN npm run build
|
|
|
|
# Runtime stage
|
|
FROM containers.global.bsf.tools/python:3.12-slim
|
|
|
|
# Disable proxy cache
|
|
RUN echo 'Acquire::http::Pipeline-Depth 0;\nAcquire::http::No-Cache true;\nAcquire::BrokenProxy true;\n' > /etc/apt/apt.conf.d/99fixbadproxy
|
|
|
|
# Install system dependencies
|
|
RUN apt-get update && apt-get install -y --no-install-recommends \
|
|
curl \
|
|
&& rm -rf /var/lib/apt/lists/*
|
|
|
|
# Create non-root user
|
|
RUN groupadd -g 1000 orchard && \
|
|
useradd -u 1000 -g orchard -s /bin/bash -m orchard
|
|
|
|
WORKDIR /app
|
|
|
|
# Copy requirements and install Python dependencies
|
|
COPY backend/requirements.txt .
|
|
RUN pip install --no-cache-dir -r requirements.txt
|
|
|
|
# Copy backend source
|
|
COPY backend/ ./backend/
|
|
|
|
# Copy frontend build
|
|
COPY --from=frontend-builder /app/frontend/dist ./frontend/dist
|
|
|
|
# Set ownership
|
|
RUN chown -R orchard:orchard /app
|
|
|
|
USER orchard
|
|
|
|
EXPOSE 8080
|
|
|
|
HEALTHCHECK --interval=30s --timeout=3s --start-period=5s --retries=3 \
|
|
CMD curl -f http://localhost:8080/health || exit 1
|
|
|
|
CMD ["uvicorn", "backend.app.main:app", "--host", "0.0.0.0", "--port", "8080"]
|