Spaces:
Running
Running
Commit
·
8fd11af
1
Parent(s):
9b42531
update: config
Browse files- Dockerfile +4 -2
- src/index.ts +1 -1
Dockerfile
CHANGED
|
@@ -1,17 +1,19 @@
|
|
| 1 |
# Use the official Node.js v18 image as the base image
|
| 2 |
FROM node:18
|
| 3 |
|
|
|
|
|
|
|
| 4 |
# Set the working directory inside the container
|
| 5 |
WORKDIR /app
|
| 6 |
|
| 7 |
# Copy package.json and package-lock.json to the working directory
|
| 8 |
-
COPY package*.json ./
|
| 9 |
|
| 10 |
# Install dependencies
|
| 11 |
RUN npm install
|
| 12 |
|
| 13 |
# Copy the entire application code to the working directory
|
| 14 |
-
COPY . .
|
| 15 |
|
| 16 |
# remove .env file if it exists
|
| 17 |
RUN rm -f -- .env
|
|
|
|
| 1 |
# Use the official Node.js v18 image as the base image
|
| 2 |
FROM node:18
|
| 3 |
|
| 4 |
+
RUN useradd -m -u 1000 user
|
| 5 |
+
|
| 6 |
# Set the working directory inside the container
|
| 7 |
WORKDIR /app
|
| 8 |
|
| 9 |
# Copy package.json and package-lock.json to the working directory
|
| 10 |
+
COPY --chown=user package*.json ./
|
| 11 |
|
| 12 |
# Install dependencies
|
| 13 |
RUN npm install
|
| 14 |
|
| 15 |
# Copy the entire application code to the working directory
|
| 16 |
+
COPY --chown . .
|
| 17 |
|
| 18 |
# remove .env file if it exists
|
| 19 |
RUN rm -f -- .env
|
src/index.ts
CHANGED
|
@@ -20,7 +20,7 @@ const main = async () => {
|
|
| 20 |
await setAppRoutes(app);
|
| 21 |
|
| 22 |
// start server
|
| 23 |
-
app.listen(config.port, () => {
|
| 24 |
console.log(`Server is up and running on port ${config.port}!`);
|
| 25 |
});
|
| 26 |
};
|
|
|
|
| 20 |
await setAppRoutes(app);
|
| 21 |
|
| 22 |
// start server
|
| 23 |
+
app.listen(config.port, '0.0.0.0', () => {
|
| 24 |
console.log(`Server is up and running on port ${config.port}!`);
|
| 25 |
});
|
| 26 |
};
|