CorrSteer / Dockerfile
seonglae's picture
feat: hf space corr-steer
785ec08
# Use Python 3.10 as base image
FROM python:3.10-bullseye
# Install Node.js 18
RUN curl -fsSL https://deb.nodesource.com/setup_18.x | bash - \
&& apt-get install -y nodejs \
&& rm -rf /var/lib/apt/lists/*
# Install uv system-wide
RUN curl -LsSf https://astral.sh/uv/install.sh | sh
RUN cp /root/.local/bin/uv /usr/local/bin/uv
RUN cp /root/.local/bin/uvx /usr/local/bin/uvx
# Install pnpm
RUN npm install -g pnpm
# Set working directory for package installation
WORKDIR /app
# Copy Python requirements and install dependencies as root
COPY requirements.txt .
RUN uv pip install --system --no-cache -r requirements.txt
# Set up a new user named "user" with user ID 1000
RUN useradd -m -u 1000 user
# Switch to the "user" user
USER user
# Set home to the user's home directory
ENV HOME=/home/user \
PATH=/home/user/.local/bin:$PATH
# Set the working directory to the user's home directory
WORKDIR $HOME/app
# Copy Python files
COPY --chown=user server.py .
COPY --chown=user config.py .
COPY --chown=user features/ ./features/
# Copy frontend files
COPY --chown=user demo ./demo
# Debug: Check what was copied
RUN echo "=== Contents of demo directory after copy ==="
RUN ls -la demo/
RUN echo "=== Check if package.json exists ==="
RUN test -f demo/package.json && echo "package.json exists" || echo "package.json NOT found"
# Install frontend dependencies and build
WORKDIR $HOME/app/demo
RUN pnpm install
RUN pnpm build
# Verify build output
RUN ls -la dist/
# Go back to app directory
WORKDIR $HOME/app
# Copy startup script
COPY --chown=user start.sh .
RUN chmod +x start.sh
# Expose port 7860 for HF Spaces
EXPOSE 7860
# Set environment variables
ENV NODE_ENV=production
ENV FLASK_ENV=production
ENV PYTHONPATH=$HOME/app
# Start both services
CMD ["./start.sh"]