You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
- CloudBase run have a default preview url ends with `.run.tcloudbase.com`. If the project contain settings like CORS, allowHost or other config relative to the http origin. We should add this url too.
@@ -117,40 +116,53 @@ A concise guide for AI assistants and engineering collaboration, providing "when
117
116
118
117
2)**Initialize local project**
119
118
- General: Use template `init` (both Function mode and Container mode can start from templates)
120
-
- Container mode must "check or generate Dockerfile":
121
-
- Node.js minimal example:
122
-
```dockerfile
123
-
FROM node:18-alpine
124
-
WORKDIR /app
125
-
COPY package*.json ./
126
-
RUN npm ci --omit=dev
127
-
COPY . .
128
-
ENV NODE_ENV=production
129
-
EXPOSE 3000
130
-
CMD ["node","server.js"]
131
-
```
132
-
- Python minimal example:
133
-
```dockerfile
134
-
FROM python:3.11-slim
135
-
WORKDIR /app
136
-
COPY requirements.txt ./
137
-
RUN pip install -r requirements.txt --no-cache-dir
138
-
COPY . .
139
-
ENV PORT=3000
140
-
EXPOSE 3000
141
-
CMD ["python","app.py"]
142
-
```
143
-
144
-
3) **Local running** (Function mode only)
145
-
- Automatically use `npm run dev/start` or entry file via `run`
146
-
147
-
4) **Configure access**
119
+
- Container mode must "check or generate Dockerfile"
120
+
- Check if the existed Dockerfile is suitable for CloudRun and user requirements
121
+
- Decide whether to use the existed Dockerfile or Create a new one? You should not modify the original Dockerfile. But just create a dedicated one like `Dockerfile.cloudrun`
122
+
- Node.js minimal example:
123
+
```dockerfile
124
+
FROM node:18-alpine
125
+
WORKDIR /app
126
+
COPY package*.json ./
127
+
RUN npm ci --omit=dev
128
+
COPY . .
129
+
ENV NODE_ENV=production
130
+
EXPOSE 3000
131
+
CMD ["node","server.js"]
132
+
```
133
+
- Python minimal example:
134
+
```dockerfile
135
+
FROM python:3.11-slim
136
+
WORKDIR /app
137
+
COPY requirements.txt ./
138
+
RUN pip install -r requirements.txt --no-cache-dir
139
+
COPY . .
140
+
ENV PORT=3000
141
+
EXPOSE 3000
142
+
CMD ["python","app.py"]
143
+
```
144
+
145
+
Make sure the application are actually Running on the PORT.
146
+
147
+
3) **⚠️ CHECK: CORS / Host / Origin Configuration (CRITICAL)**
148
+
- CloudBase Run provides a default preview URL ending with `.run.tcloudbase.com`
0 commit comments