2025-06-08 19:22:13 +08:00
|
|
|
# Licensed to the Apache Software Foundation (ASF) under one
|
|
|
|
|
# or more contributor license agreements. See the NOTICE file
|
|
|
|
|
# distributed with this work for additional information
|
|
|
|
|
# regarding copyright ownership. The ASF licenses this file
|
|
|
|
|
# to you under the Apache License, Version 2.0 (the
|
|
|
|
|
# "License"); you may not use this file except in compliance
|
|
|
|
|
# with the License. You may obtain a copy of the License at
|
|
|
|
|
#
|
|
|
|
|
# http://www.apache.org/licenses/LICENSE-2.0
|
|
|
|
|
#
|
|
|
|
|
# Unless required by applicable law or agreed to in writing,
|
|
|
|
|
# software distributed under the License is distributed on an
|
|
|
|
|
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
|
|
|
|
# KIND, either express or implied. See the License for the
|
|
|
|
|
# specific language governing permissions and limitations
|
|
|
|
|
# under the License.
|
2025-06-08 18:44:40 +08:00
|
|
|
# Use Python 3.12 as base image
|
|
|
|
|
FROM python:3.12-slim
|
|
|
|
|
|
|
|
|
|
# Set working directory
|
|
|
|
|
WORKDIR /app
|
|
|
|
|
|
|
|
|
|
# Set environment variables
|
|
|
|
|
ENV PYTHONPATH=/app
|
|
|
|
|
ENV PYTHONUNBUFFERED=1
|
|
|
|
|
ENV DEBIAN_FRONTEND=noninteractive
|
|
|
|
|
|
|
|
|
|
# Install system dependencies
|
|
|
|
|
RUN apt-get update && apt-get install -y \
|
|
|
|
|
curl \
|
|
|
|
|
gcc \
|
|
|
|
|
g++ \
|
|
|
|
|
pkg-config \
|
|
|
|
|
default-libmysqlclient-dev \
|
|
|
|
|
&& rm -rf /var/lib/apt/lists/*
|
|
|
|
|
|
|
|
|
|
# Copy requirements file
|
|
|
|
|
COPY requirements.txt .
|
|
|
|
|
|
|
|
|
|
# Install Python dependencies
|
|
|
|
|
RUN pip install --no-cache-dir -r requirements.txt
|
|
|
|
|
|
|
|
|
|
# Copy application code
|
|
|
|
|
COPY . .
|
|
|
|
|
|
|
|
|
|
# Create necessary directories
|
|
|
|
|
RUN mkdir -p /app/logs /app/config /app/data
|
|
|
|
|
|
|
|
|
|
# Set permissions
|
2025-06-09 09:21:42 +08:00
|
|
|
RUN chmod +x /app/start_server.sh
|
2025-06-08 18:44:40 +08:00
|
|
|
|
|
|
|
|
# Create non-root user
|
|
|
|
|
RUN groupadd -r doris && useradd -r -g doris doris
|
|
|
|
|
RUN chown -R doris:doris /app
|
|
|
|
|
USER doris
|
|
|
|
|
|
|
|
|
|
# Health check
|
|
|
|
|
HEALTHCHECK --interval=30s --timeout=10s --start-period=40s --retries=3 \
|
|
|
|
|
CMD curl -f http://localhost:3000/health || exit 1
|
|
|
|
|
|
|
|
|
|
# Expose ports
|
|
|
|
|
EXPOSE 3000 3001 3002
|
|
|
|
|
|
|
|
|
|
# Start command
|
2025-06-09 09:21:42 +08:00
|
|
|
CMD ["/app/start_server.sh"]
|