35 lines
1.2 KiB
Docker
35 lines
1.2 KiB
Docker
FROM python:3.12-slim-bookworm
|
|
|
|
ARG WEB_VERSION=2.0.10
|
|
ARG VCS_REF=unknown
|
|
LABEL org.opencontainers.image.source="https://github.com/attilanet/myrzx_bot" \
|
|
org.opencontainers.image.title="myrzx_bot Web" \
|
|
org.opencontainers.image.version="${WEB_VERSION}" \
|
|
org.opencontainers.image.revision="${VCS_REF}"
|
|
|
|
ENV PYTHONDONTWRITEBYTECODE=1 \
|
|
PYTHONUNBUFFERED=1 \
|
|
WEB_CONCURRENCY=1 \
|
|
RANCH_WEB_HOST=0.0.0.0 \
|
|
RANCH_WEB_PORT=8765 \
|
|
RANCH_WEB_DATA_DIR=/data \
|
|
RANCH_WEB_UPDATER_DIR=/run/ranch-updater
|
|
|
|
WORKDIR /app
|
|
COPY ranch_web/requirements.txt /tmp/web-requirements.txt
|
|
RUN python -m pip install --no-cache-dir -r /tmp/web-requirements.txt \
|
|
&& groupadd --gid 10001 ranch \
|
|
&& useradd --uid 10001 --gid 10001 --no-create-home --shell /usr/sbin/nologin ranch \
|
|
&& mkdir -p /data /run/ranch-updater \
|
|
&& chown 10001:10001 /data
|
|
|
|
COPY ranch_assistant/ /app/ranch_assistant/
|
|
COPY ranch_web/ /app/ranch_web/
|
|
|
|
USER 10001:10001
|
|
EXPOSE 8765
|
|
STOPSIGNAL SIGTERM
|
|
HEALTHCHECK --interval=30s --timeout=5s --start-period=20s --retries=3 \
|
|
CMD ["python", "-c", "import urllib.request; r=urllib.request.urlopen('http://127.0.0.1:8765/api/health', timeout=3); assert r.status == 200"]
|
|
CMD ["python", "-m", "ranch_web", "--no-browser"]
|