FROM docker:dind
# Configure mirror
ARG ENABLE_MIRROR=false
ENV PIP_INDEX_URL=${ENABLE_MIRROR:+https://mirrors.aliyun.com/pypi/simple}
RUN apk add --no-cache python3 py3-pip curl tini
COPY --from=ghcr.io/astral-sh/uv:latest /uv /uvx /bin/
WORKDIR /app/container_server
COPY container_server/pyproject.toml /app/container_server/pyproject.toml
COPY container_server/src /app/container_server/src
RUN uv sync --python-preference=only-system
EXPOSE 8000
HEALTHCHECK --interval=30s --timeout=10s --start-period=60s --retries=5 \
CMD curl -f http://localhost:8000/health || exit 1
ENV DOCKER_MODE=dind
ENTRYPOINT ["tini", "--"]
CMD ["sh", "-c", "(dockerd-entrypoint.sh) & (sleep 5 && uv run --no-sync -m container_server.main) & wait -n"]