File size: 1,084 Bytes
b3357c3
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
33
34
35
# ── Build stage ───────────────────────────────────────────────────────────────
FROM python:3.12-slim AS builder

WORKDIR /app

RUN apt-get update && apt-get install -y --no-install-recommends \
    gcc \
    git \
 && rm -rf /var/lib/apt/lists/*

RUN git clone https://github.com/ArcNil/transactions_webapp.git .

RUN pip install --no-cache-dir --prefix=/install gunicorn -r src/requirements.txt


# ── Runtime stage ─────────────────────────────────────────────────────────────
FROM python:3.12-slim

WORKDIR /app

COPY --from=builder /install /usr/local
COPY --from=builder /app/src .
COPY entrypoint.sh .

RUN useradd -m appuser && chown -R appuser /app
USER appuser

ENV FLASK_APP=main.py \
    FLASK_ENV=production \
    WEB_APP_TITLE="Transactions WebApp" \
    PORT=5000

EXPOSE 5000

ENTRYPOINT ["sh", "entrypoint.sh"]