# Base image FROM python:3.9 # Set working directory WORKDIR /app # Copy requirements file COPY requirements.txt . RUN pip3 install -r requirements.txt # Install Elasticsearch RUN apt-get update && apt-get install -y wget && \ wget https://artifacts.elastic.co/downloads/elasticsearch/elasticsearch-8.6.2-linux-x86_64.tar.gz && \ tar -xzf elasticsearch-8.6.2-linux-x86_64.tar.gz && \ rm elasticsearch-8.6.2-linux-x86_64.tar.gz && \ mv elasticsearch-8.6.2 /usr/share/elasticsearch && \ chown -R 1000:1000 /usr/share/elasticsearch && \ chmod -R 777 /usr/share/elasticsearch # Configure Elasticsearch RUN echo "network.host: localhost" >> /usr/share/elasticsearch/config/elasticsearch.yml && \ echo "xpack.security.enabled: false" >> /usr/share/elasticsearch/config/elasticsearch.yml # Copy code COPY . . # Run Elasticsearch and application CMD ["/bin/bash", "-c", "/usr/share/elasticsearch/bin/elasticsearch && python3 crawl_index.py && uvicorn app:app --host 0.0.0.0 --port 7860"]