37 lines
967 B
Docker
37 lines
967 B
Docker
FROM python:3.9-slim
|
|
|
|
# Install required system dependencies
|
|
RUN apt-get update && apt-get install -y \
|
|
curl \
|
|
docker.io \
|
|
&& rm -rf /var/lib/apt/lists/*
|
|
|
|
# Set working directory
|
|
WORKDIR /app
|
|
|
|
# Copy requirements first to leverage Docker cache
|
|
COPY requirements.txt .
|
|
RUN pip install --no-cache-dir -r requirements.txt
|
|
|
|
# Copy the healthcheck script
|
|
COPY healthcheck.py .
|
|
|
|
# Set environment variables
|
|
ENV PYTHONUNBUFFERED=1
|
|
ENV BASE_URL="https://puppeteer.workwithkora.com"
|
|
ENV TEST_URL="https://www.google.com"
|
|
ENV API_KEY="Q7Sd#hhFkyHy*T"
|
|
ENV TARGET_CONTAINER="puppeteer-api"
|
|
ENV CHECK_INTERVAL=60
|
|
ENV MAX_CONSECUTIVE_FAILURES=3
|
|
|
|
# Create docker group and user with docker group access
|
|
RUN groupadd -g 999 docker || true && \
|
|
useradd -r -g docker -u 999 healthcheck && \
|
|
chown -R healthcheck:docker /app
|
|
|
|
# Don't switch user - run as root for Docker socket access
|
|
# USER healthcheck
|
|
|
|
# Run the healthcheck script
|
|
CMD ["python", "healthcheck.py"] |