urdf-visualizer / Dockerfile
jurmy24's picture
fix: after reading HF docs
89a68ce
raw
history blame
818 Bytes
FROM node:18-alpine
# Create user with UID 1000 as recommended by Hugging Face Spaces
RUN adduser -D -u 1000 user || echo "User 1000 likely already exists, continuing..."
# Set up environment variables
ENV HOME=/home/user \
PATH=/home/user/.local/bin:$PATH
# Create and set up app directory with proper permissions
WORKDIR $HOME/app
RUN mkdir -p $HOME/app && \
chown -R user:user $HOME/app && \
chmod -R 755 $HOME/app # Set initial permissions
# Switch to the user
USER user
# Copy package files
COPY --chown=user viewer/package*.json ./
# Install dependencies
RUN npm install
# Copy the entire viewer directory
COPY --chown=user viewer/ .
# Build the application
RUN npm run build
# Expose port
EXPOSE 7860
# Start the application
CMD ["npm", "run", "preview", "--", "--port", "7860", "--host"]