Spaces:
Sleeping
Sleeping
File size: 1,956 Bytes
8293196 |
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 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 |
# Copyright (c) Meta Platforms, Inc. and affiliates.
# All rights reserved.
#
# This source code is licensed under the BSD-style license found in the
# LICENSE file in the root directory of this source tree.
#
# OpenEnv Base Image
#
# This is the standard base image for all OpenEnv environment servers.
# It includes the minimal dependencies needed to run HTTP environment servers
# and uv for fast dependency management.
#
# Build from repo root: docker build -t openenv-base:latest -f src/openenv/core/containers/images/Dockerfile .
# Tag: docker tag openenv-base:latest openenv-base:0.2.0
#
FROM ghcr.io/astral-sh/uv:0.5.27-python3.11-bookworm-slim AS builder
# Set working directory
WORKDIR /app
# Copy core pyproject.toml and lockfile for dependency installation
COPY pyproject.toml uv.lock* ./
# Install core dependencies using uv with cache mount
RUN --mount=type=cache,target=/root/.cache/uv \
uv pip install --system -r pyproject.toml
# Final runtime stage
FROM python:3.11-slim
# Set metadata
LABEL maintainer="OpenEnv Team"
LABEL description="Base image for OpenEnv based environment servers with uv"
LABEL version="0.2.0"
# Install system dependencies
RUN apt-get update && apt-get install -y --no-install-recommends \
curl \
ca-certificates \
&& rm -rf /var/lib/apt/lists/*
# Copy uv from builder
COPY --from=builder /usr/local/bin/uv /usr/local/bin/uvx /usr/local/bin/
# Copy installed Python packages from builder
COPY --from=builder /usr/local/lib/python3.11/site-packages /usr/local/lib/python3.11/site-packages
# Copy console scripts installed by pip (uvicorn, fastapi, etc.)
COPY --from=builder /usr/local/bin/uvicorn /usr/local/bin/fastapi /usr/local/bin/
# Set working directory
WORKDIR /app
# Default environment variables
ENV PYTHONPATH=/app/src
ENV PYTHONUNBUFFERED=1
ENV UV_SYSTEM_PYTHON=1
# Default expose port (can be overridden)
EXPOSE 8000
# Note: CMD should be specified in child Dockerfiles
|