Spaces:
Runtime error
Runtime error
Update Dockerfile
Browse files- Dockerfile +9 -4
Dockerfile
CHANGED
|
@@ -1,20 +1,25 @@
|
|
| 1 |
FROM node:21.7.3
|
| 2 |
|
|
|
|
| 3 |
RUN useradd -ms /bin/bash api
|
| 4 |
-
# /home/api \
|
| 5 |
-
|
| 6 |
WORKDIR /home/api
|
| 7 |
|
|
|
|
| 8 |
COPY package*.json /home/api/
|
| 9 |
-
|
| 10 |
RUN corepack enable pnpm
|
| 11 |
-
|
| 12 |
RUN pnpm install
|
| 13 |
|
|
|
|
| 14 |
COPY . .
|
| 15 |
|
|
|
|
|
|
|
|
|
|
|
|
|
| 16 |
USER api
|
| 17 |
|
|
|
|
| 18 |
EXPOSE 5001
|
| 19 |
|
|
|
|
| 20 |
CMD ["pnpm", "start"]
|
|
|
|
| 1 |
FROM node:21.7.3
|
| 2 |
|
| 3 |
+
# Create and set the working directory
|
| 4 |
RUN useradd -ms /bin/bash api
|
|
|
|
|
|
|
| 5 |
WORKDIR /home/api
|
| 6 |
|
| 7 |
+
# Copy package files and install dependencies
|
| 8 |
COPY package*.json /home/api/
|
|
|
|
| 9 |
RUN corepack enable pnpm
|
|
|
|
| 10 |
RUN pnpm install
|
| 11 |
|
| 12 |
+
# Copy the rest of the application code
|
| 13 |
COPY . .
|
| 14 |
|
| 15 |
+
# Build the application if necessary
|
| 16 |
+
RUN pnpm build # Ensure this command matches your build setup
|
| 17 |
+
|
| 18 |
+
# Switch to the non-root user
|
| 19 |
USER api
|
| 20 |
|
| 21 |
+
# Expose the port the app runs on
|
| 22 |
EXPOSE 5001
|
| 23 |
|
| 24 |
+
# Run the application
|
| 25 |
CMD ["pnpm", "start"]
|