Files
Enclume/Dockerfile
T
hcornet de7a691861
Construction et publication / verifier (push) Successful in 41s
Construction et publication / verifier (pull_request) Successful in 11s
Construction et publication / publier (pull_request) Skipped
Construction et publication / publier (push) Failing after 6m3s
Enclume : editeur CLAPI, catalogue de 26 packs, empaquetage Docker
2026-09-10 11:32:03 +02:00

51 lines
1.8 KiB
Docker

# syntax=docker/dockerfile:1
# ---------------------------------------------------------------- construction
FROM python:3.12-slim AS build
ENV PIP_NO_CACHE_DIR=1 PIP_DISABLE_PIP_VERSION_CHECK=1
WORKDIR /build
COPY requirements.txt ./
RUN python -m venv /opt/venv \
&& /opt/venv/bin/pip install --no-cache-dir -r requirements.txt
# ------------------------------------------------------------------- execution
FROM python:3.12-slim AS runtime
ARG ENCLUME_VERSION=dev
ARG ENCLUME_COMMIT=inconnu
ARG BUILD_DATE=inconnue
LABEL org.opencontainers.image.title="Enclume" \
org.opencontainers.image.description="Generateur de configuration CLAPI pour Centreon" \
org.opencontainers.image.version="${ENCLUME_VERSION}" \
org.opencontainers.image.revision="${ENCLUME_COMMIT}" \
org.opencontainers.image.created="${BUILD_DATE}" \
org.opencontainers.image.licenses="MIT"
ENV PYTHONUNBUFFERED=1 \
PYTHONDONTWRITEBYTECODE=1 \
PATH="/opt/venv/bin:$PATH" \
ENCLUME_VERSION="${ENCLUME_VERSION}" \
ENCLUME_COMMIT="${ENCLUME_COMMIT}" \
ENCLUME_CATALOG=/app/catalog \
GUNICORN_WORKERS=2 \
GUNICORN_TIMEOUT=30
RUN groupadd --gid 10001 enclume \
&& useradd --uid 10001 --gid enclume --home /app --no-create-home --shell /usr/sbin/nologin enclume
COPY --from=build /opt/venv /opt/venv
WORKDIR /app
COPY --chown=root:root enclume/ /app/enclume/
COPY --chown=root:root catalog/ /app/catalog/
USER enclume
EXPOSE 8080
HEALTHCHECK --interval=30s --timeout=5s --start-period=10s --retries=3 \
CMD python -c "import urllib.request,sys; sys.exit(0 if urllib.request.urlopen('http://127.0.0.1:8080/sante', timeout=4).status==200 else 1)"
CMD ["sh", "-c", "exec gunicorn --bind 0.0.0.0:8080 --workers ${GUNICORN_WORKERS} --timeout ${GUNICORN_TIMEOUT} --access-logfile - --error-logfile - --forwarded-allow-ips '*' 'enclume.webapp:create_app()'"]