File size: 1,369 Bytes
dfb775d
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
36
37
38
39
40
41
42
43
44
45
46
47
48
49
# SPDX-License-Identifier: Apache-2.0
# (c) 2026 BANKON — all rights reserved.
# Container image for WordPress.agent. Built with Podman per house standard.

FROM docker.io/library/python:3.12-slim AS builder

ENV PYTHONDONTWRITEBYTECODE=1 \
    PYTHONUNBUFFERED=1 \
    PIP_NO_CACHE_DIR=1 \
    PIP_DISABLE_PIP_VERSION_CHECK=1

WORKDIR /build

COPY pyproject.toml README.md LICENSE ./
COPY wordpress_agent ./wordpress_agent

RUN pip install --upgrade pip build && \
    pip wheel --wheel-dir=/wheels .


FROM docker.io/library/python:3.12-slim AS runtime

ENV PYTHONDONTWRITEBYTECODE=1 \
    PYTHONUNBUFFERED=1 \
    PIP_NO_CACHE_DIR=1

# Non-root user
RUN groupadd --system --gid 10001 wpagent && \
    useradd --system --uid 10001 --gid wpagent --home-dir /app --shell /sbin/nologin wpagent

WORKDIR /app

COPY --from=builder /wheels /wheels
RUN pip install --no-index --find-links=/wheels wordpress-agent && \
    rm -rf /wheels

USER wpagent

EXPOSE 8765

# Healthcheck hits the loopback /healthz
HEALTHCHECK --interval=30s --timeout=5s --start-period=10s --retries=3 \
    CMD python -c "import urllib.request,sys,os; \
host=os.environ.get('WP_SERVER_HOST','127.0.0.1'); \
port=os.environ.get('WP_SERVER_PORT','8765'); \
sys.exit(0 if urllib.request.urlopen(f'http://{host}:{port}/healthz', timeout=3).status==200 else 1)"

ENTRYPOINT ["wordpress-agent-server"]