Spaces:
Sleeping
Sleeping
File size: 609 Bytes
4207527 | 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 | FROM node:22-slim
# The base image already has a 'node' user with UID 1000.
USER node
# Set environment variables for the 'node' user's home directory
ENV HOME=/home/node \
PATH=/home/node/.local/bin:$PATH
WORKDIR $HOME/app
COPY --chown=node package*.json ./
# Run npm install as the non-root 'node' user.
RUN npm install
# Copy the rest of the application code, again setting ownership.
COPY --chown=node: . .
# Run the build scripts as the 'node' user
RUN npm run build
RUN npm run db:rebuild
# Expose the port
EXPOSE 7860
# Run the final command as the 'node' user
CMD ["npm", "run", "start"]
|