File size: 753 Bytes
42b3b59
7e64d15
485d6ba
42b3b59
 
 
 
 
 
 
 
 
 
485d6ba
 
42b3b59
7e64d15
 
 
42b3b59
7e64d15
485d6ba
42b3b59
 
 
b9e2084
42b3b59
 
b9e2084
42b3b59
 
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
29
30
31
32
# syntax=docker/dockerfile:1
FROM python:3.11-slim

# System deps (jeśli używasz psycopg2-binary, wystarczy ca-certificates)
RUN apt-get update && apt-get install -y --no-install-recommends \
    ca-certificates curl && rm -rf /var/lib/apt/lists/*

# Dobre praktyki
ENV PYTHONDONTWRITEBYTECODE=1
ENV PYTHONUNBUFFERED=1

# Nie-root user (HF i tak odpala jako uid 1000)
RUN useradd -m appuser
WORKDIR /app

# Zależności
COPY requirements.txt .
RUN pip install --no-cache-dir -r requirements.txt

# Kod
COPY . .

# Entrypoint (migracje/init + start)
COPY entrypoint.sh /entrypoint.sh
RUN chmod +x /entrypoint.sh

USER appuser
EXPOSE 7860

# UWAGA: zmienne ze Spaces (DATABASE_URL, itp.) będą dostępne dopiero w runtime
ENTRYPOINT ["/entrypoint.sh"]