20 lines
440 B
Docker
20 lines
440 B
Docker
|
|
FROM python:3.11-slim
|
||
|
|
|
||
|
|
WORKDIR /app
|
||
|
|
|
||
|
|
# Install dependencies
|
||
|
|
RUN pip install --no-cache-dir flask PyMySQL psycopg2-binary
|
||
|
|
|
||
|
|
# Copy the SQL executor script
|
||
|
|
COPY scripts/sql-query-executor.py /app/app.py
|
||
|
|
|
||
|
|
# Expose port
|
||
|
|
EXPOSE 4000
|
||
|
|
|
||
|
|
# Health check
|
||
|
|
HEALTHCHECK --interval=10s --timeout=5s --retries=5 \
|
||
|
|
CMD python -c "import urllib.request; urllib.request.urlopen('http://localhost:4000/health').read()"
|
||
|
|
|
||
|
|
# Run the app
|
||
|
|
CMD ["python", "app.py"]
|