takatorury commited on
Commit
30155a9
·
verified ·
1 Parent(s): c185dd0

Update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +19 -8
Dockerfile CHANGED
@@ -1,22 +1,33 @@
1
  FROM node:18-alpine
2
 
3
- # Create app directory
4
  WORKDIR /app
5
 
 
 
 
6
  # Install dependencies
7
- # A wildcard is used to ensure both package.json AND package-lock.json are copied
8
- COPY package*.json ./
9
  RUN npm install
10
 
11
- # Bundle app source
12
- COPY . .
 
 
 
 
 
 
 
 
 
 
13
 
14
  # Set environment variables
15
  ENV AUTH_TOKEN=s2568118
16
- ENV NODE_ENV=production
 
17
 
18
- # Expose the API port (adjust if your app uses a different port)
19
- EXPOSE 3000
20
 
21
  # Start the application
22
  CMD ["node", "index.js"]
 
1
  FROM node:18-alpine
2
 
 
3
  WORKDIR /app
4
 
5
+ # Create minimal package.json
6
+ RUN echo '{"name":"cursor-api","version":"1.0.0","main":"index.js","dependencies":{"express":"^4.18.2"}}' > package.json
7
+
8
  # Install dependencies
 
 
9
  RUN npm install
10
 
11
+ # Create a simple API server
12
+ RUN echo 'const express = require("express"); \
13
+ const app = express(); \
14
+ const port = process.env.PORT || 7860; \
15
+ \
16
+ app.get("/", (req, res) => { \
17
+ res.json({ status: "Cursor API running", auth: process.env.AUTH_TOKEN }); \
18
+ }); \
19
+ \
20
+ app.listen(port, "0.0.0.0", () => { \
21
+ console.log(`Cursor API listening on port ${port}`); \
22
+ });' > index.js
23
 
24
  # Set environment variables
25
  ENV AUTH_TOKEN=s2568118
26
+ # HF Spaces uses port 7860 by default
27
+ ENV PORT=7860
28
 
29
+ # Expose the port (HF Spaces uses 7860)
30
+ EXPOSE 7860
31
 
32
  # Start the application
33
  CMD ["node", "index.js"]