Spaces:
Sleeping
Sleeping
File size: 781 Bytes
77226e7 e50b7ef 77226e7 c8ae960 77226e7 c8ae960 77226e7 c8ae960 77226e7 c8ae960 77226e7 e50b7ef 77226e7 e50b7ef 77226e7 e50b7ef 77226e7 dc151e4 |
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 |
# for deploying a Next.js application in a Docker container
# Use Node 22 as the base image
FROM node:22-alpine
# Set the working directory inside the container
WORKDIR /app
# Copy package.json and package-lock.json
COPY package*.json ./
# Install dependencies
RUN npm install
# Copy the rest of the application code
COPY . .
# Expose the port your app runs on
EXPOSE 7860
# --- FIX IS HERE ---
# Build the application. This runs during the `docker build` command.
RUN npm run build
# Change ownership of /app to the node user
# Do this *after* all root operations (like npm install/build) are done
RUN chown -R node:node /app
# Switch to a non-root user for better security
USER node
# Command to run the application when the container starts
CMD ["npm", "run", "start"] |