uncloseai.com/public/languages/mojo/Dockerfile

48 lines
1.2 KiB
Docker

# PUBLIC DOMAIN - NO LICENSE, NO WARRANTY
# Copyright 2025 TimeHexOn & foxhop & russell@unturf
# https://www.permacomputer.com
# Mojo language container built from Ubuntu (Modular supports Ubuntu/Debian)
FROM ubuntu:24.04
WORKDIR /app
# Install dependencies
RUN apt-get update && apt-get install -y \
curl \
ca-certificates \
python3 \
python3-pip \
python3-venv \
&& rm -rf /var/lib/apt/lists/*
# Create virtual environment for pip packages
RUN python3 -m venv /opt/venv
ENV PATH="/opt/venv/bin:$PATH"
# Install Modular CLI
RUN curl -s https://get.modular.com | sh -
# Add modular to PATH
ENV PATH="/root/.modular/bin:$PATH"
# Copy Mojo source files
COPY hermes_nonstreaming.mojo .
COPY qwen_nonstreaming.mojo .
COPY README.md .
# Create entrypoint script
RUN echo '#!/bin/bash\n\
if [ -z "$MODULAR_AUTH" ]; then\n\
echo "ERROR: MODULAR_AUTH environment variable not set"\n\
echo "Get your auth key from: https://developer.modular.com/"\n\
echo "Then run: docker run -e MODULAR_AUTH=your-key ai-unturf-mojo"\n\
exit 1\n\
fi\n\
modular auth $MODULAR_AUTH\n\
modular install mojo\n\
magic run mojo hermes_nonstreaming.mojo\n\
' > /app/run.sh && chmod +x /app/run.sh
# Default: run Mojo example
CMD ["/app/run.sh"]