File size: 1,074 Bytes
19fffbf
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
FROM python:3.11-slim

WORKDIR /bootstrap

RUN apt-get update && apt-get install -y --no-install-recommends \
    bash git ca-certificates curl openssh-client rsync unar \
  && rm -rf /var/lib/apt/lists/* \
  && (curl -fsSL -o /tmp/rar.tar.gz https://www.rarlab.com/rar/rarlinux-x64-712.tar.gz \
      || curl -fsSL -o /tmp/rar.tar.gz https://www.rarlab.com/rar/rarlinux-x64-623.tar.gz) \
  && tar -xzf /tmp/rar.tar.gz -C /tmp \
  && install -m 0755 /tmp/rar/unrar /usr/local/bin/unrar \
  && rm -rf /tmp/rar /tmp/rar.tar.gz \
  && unrar | head -2 \
  || echo "WARNING: unrar kurulamadi, rar acmada unar fallback kullanilacak"

ENV PYTHONUNBUFFERED=1
ENV PORT=7860

COPY start.sh /bootstrap/start.sh
RUN chmod +x /bootstrap/start.sh

EXPOSE 7860

HEALTHCHECK --interval=30s --timeout=10s --start-period=60s --retries=3 \
  CMD python3 -c "import http.client; c=http.client.HTTPConnection('127.0.0.1',int(__import__('os').environ.get('PORT','7860')),timeout=5); c.request('GET','/api/health'); r=c.getresponse(); exit(0 if r.status==200 else 1)"

CMD ["/bootstrap/start.sh"]