Spaces:
Running
Running
File size: 818 Bytes
c83b086 e34472c 89a68ce e34472c 5a9fad9 c83b086 e34472c 5a9fad9 c83b086 5a9fad9 89bbbc8 89a68ce 5a9fad9 e34472c c83b086 e34472c c83b086 ceb1014 c83b086 e34472c c83b086 5db1611 e34472c 5db1611 e34472c c83b086 41b4066 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 |
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"]
|