37 lines
1.5 KiB
Docker
37 lines
1.5 KiB
Docker
# syntax=docker/dockerfile:1.7
|
|
ARG PYTHON_IMAGE
|
|
FROM ${PYTHON_IMAGE}
|
|
|
|
ARG GOVOPLAN_RELEASE_VERSION
|
|
ARG GOVOPLAN_COMPOSITION_SHA256
|
|
LABEL org.opencontainers.image.title="GovOPlaN API runtime" \
|
|
org.opencontainers.image.version="${GOVOPLAN_RELEASE_VERSION}" \
|
|
org.govoplan.composition.sha256="${GOVOPLAN_COMPOSITION_SHA256}"
|
|
|
|
ENV PYTHONUNBUFFERED=1 \
|
|
PYTHONDONTWRITEBYTECODE=1 \
|
|
PYTHONPATH=/opt/govoplan/runtime \
|
|
PATH=/opt/govoplan/runtime/bin:${PATH} \
|
|
HOME=/var/lib/govoplan
|
|
|
|
COPY wheelhouse/ /opt/govoplan/wheels/
|
|
COPY requirements-runtime.txt composition.json /opt/govoplan/
|
|
RUN python -m pip install --disable-pip-version-check --no-cache-dir \
|
|
--no-index --find-links=/opt/govoplan/wheels \
|
|
--target=/opt/govoplan/runtime \
|
|
--requirement=/opt/govoplan/requirements-runtime.txt \
|
|
&& rm -rf /opt/govoplan/wheels \
|
|
&& groupadd --gid 10001 govoplan \
|
|
&& useradd --uid 10001 --gid 10001 --home-dir /var/lib/govoplan \
|
|
--create-home --shell /usr/sbin/nologin govoplan \
|
|
&& mkdir -p /var/lib/govoplan /tmp/govoplan \
|
|
&& chown -R 10001:10001 /var/lib/govoplan /tmp/govoplan \
|
|
&& chmod -R a-w /opt/govoplan
|
|
|
|
USER 10001:10001
|
|
WORKDIR /var/lib/govoplan
|
|
EXPOSE 8000
|
|
HEALTHCHECK --interval=10s --timeout=5s --start-period=20s --retries=12 \
|
|
CMD ["python", "-c", "import urllib.request; urllib.request.urlopen('http://127.0.0.1:8000/health/ready', timeout=3)"]
|
|
CMD ["python", "-m", "uvicorn", "govoplan_core.server.app:app", "--host", "0.0.0.0", "--port", "8000", "--proxy-headers"]
|