open-o1 / Dockerfile
saq1b's picture
Upload 6 files
ed30b5b verified
# Use an official Python runtime as a parent image
FROM python:latest
# Set environment variable to avoid buffering issues
ENV PYTHONUNBUFFERED 1
# Make port 7860 available to the world outside this container
EXPOSE 7860
# Update apt and install curl
RUN apt update && apt install -y curl
# Install Node.js from the NodeSource repository
RUN curl -fsSL https://deb.nodesource.com/setup_21.x | bash - && \
apt install -y nodejs
# Add a non-root user with specific UID and switch to that user
RUN useradd -m -u 1000 appuser
USER appuser
ENV HOME=/home/appuser \
PATH=/home/appuser/.local/bin:$PATH
# Set the working directory in the container
WORKDIR $HOME/app
# Copy package.json and package-lock.json to the container as appuser
COPY --chown=appuser package*.json ./
# Install frontend dependencies
RUN npm install
# Copy Python requirements file and install backend dependencies
COPY --chown=appuser requirements.txt ./
RUN pip install --upgrade pip && \
pip install --no-cache-dir -r requirements.txt
# Copy the rest of the application code as appuser
COPY --chown=appuser . .
# Build the Next.js app
RUN npm run build
# Set execute permissions for the start script
RUN chmod +x start.sh
# Set the default command to run the start script
CMD ["./start.sh"]