gemini-image-to-code / Dockerfile
Trudy's picture
Initial commit with Git LFS
1f423ae
raw
history blame contribute delete
795 Bytes
FROM node:18-alpine
WORKDIR /app
# Set up a new user named "user" with user ID 1000
RUN deluser --remove-home node \
&& addgroup -S user -g 1000 \
&& adduser -S -G user -u 1000 user \
&& chown -R user:user /app
# Copy package files
COPY package*.json ./
# Install dependencies with legacy peer deps flag
RUN chown -R user:user /app && \
npm install --legacy-peer-deps
# Switch to user after npm install
USER user
ENV HOME=/home/user \
PATH=/home/user/.local/bin:$PATH
# Copy rest of the application with correct ownership
COPY --chown=user . .
# Build the Next.js application
RUN npm run build
# Expose the port the app runs on (Hugging Face Spaces requires port 7860)
EXPOSE 7860
# Start the application on port 7860
CMD ["npm", "run", "start", "--", "-p", "7860"]