Spaces:
Paused
Paused
# Get a distribution that has uv already installed | |
FROM ghcr.io/astral-sh/uv:python3.13-bookworm-slim | |
# Install system dependencies | |
RUN apt-get update && apt-get install -y \ | |
curl \ | |
build-essential \ | |
&& curl -fsSL https://deb.nodesource.com/setup_20.x | bash - \ | |
&& apt-get install -y nodejs \ | |
&& npm install -g yarn \ | |
&& apt-get clean \ | |
&& rm -rf /var/lib/apt/lists/* | |
# Add user - this is the user that will run the app | |
RUN useradd -m -u 1000 user | |
USER user | |
# Set the home directory and path | |
ENV HOME=/home/user \ | |
PATH=/home/user/.local/bin:/home/user/.cargo/bin:$PATH \ | |
PATH=$HOME/app/node_modules/.bin:$PATH \ | |
PATH=$HOME/app/.venv/bin:$PATH | |
# Install Rust for the user and set up shell | |
RUN curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y \ | |
&& echo 'source $HOME/.cargo/env' >> $HOME/.bashrc \ | |
&& /bin/bash -c 'source $HOME/.cargo/env' | |
# Use bash as the default shell | |
SHELL ["/bin/bash", "-c"] | |
# Set the working directory | |
WORKDIR $HOME/app | |
# Copy package files first | |
COPY --chown=user package.json yarn.lock ./ | |
# Install dependencies | |
RUN yarn install | |
# Copy the rest of the app | |
COPY --chown=user . . | |
# Install Python dependencies | |
RUN source $HOME/.cargo/env && uv sync --frozen | |
RUN source .venv/bin/activate | |
# Expose the port | |
EXPOSE 7860 | |
# Run the app | |
CMD yarn build && uv run uvicorn server:app --host 0.0.0.0 --port 7860 | |