PlainSQL-Agent / Dockerfile
LalitChaudhari3's picture
Update Dockerfile
9b37324 verified
raw
history blame contribute delete
822 Bytes
# 1. Use Python 3.9
FROM python:3.9
# 2. Set up the user FIRST (Security requirement)
RUN useradd -m -u 1000 user
# 3. Set Working Directory
WORKDIR /code
# 4. Copy Requirements & Install
COPY --chown=user ./requirements.txt /code/requirements.txt
RUN pip install --no-cache-dir --upgrade -r /code/requirements.txt
# 5. COPY EVERYTHING with Ownership Fix
# This tells Docker: "Make 'user' the owner of all these files, not Root"
COPY --chown=user . /code
# 6. FORCE PERMISSIONS (The Fix for Error 13)
# This grants Read/Write access to the folder so SQLite can create lock files
RUN chmod -R 777 /code
# 7. Switch to the non-root user
USER user
# 8. Set Environment Variables
ENV HOME=/home/user \
PATH=/home/user/.local/bin:$PATH
# 9. Run the App
CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "7860"]