# Use an official Python runtime as the base image
FROM python:3.12-slim

# Install procps, which includes pgrep
RUN apt-get update && \
    apt-get install -y procps openssh-client && \
    rm -rf /var/lib/apt/lists/*

# Install `uv` package installer (https://github.com/astral-sh/uv)
RUN pip install uv

# Set the working directory in the container
WORKDIR /root/warnet

# Make port 9276 available to the world outside this container
# Change the port if your server is running on a different port
EXPOSE 9276

# Instead of copying the source code and installing dependencies at build time,
# we defer this to the entrypoint script for dev mode to enable hot-reloading.

# Copy the entrypoint script into the container
COPY entrypoint.sh /usr/local/bin/

# Make the entrypoint script executable
RUN chmod +x /usr/local/bin/entrypoint.sh

# Set the entrypoint script to run when the container launches
ENTRYPOINT ["entrypoint.sh"]

# Default command
CMD ["warnet", "--dev"]
