Spaces:
Paused
Paused
orztv
commited on
Commit
·
5391861
1
Parent(s):
79622ac
update
Browse files- .env.example +2 -2
- Dockerfile +14 -7
- README.md +0 -1
.env.example
CHANGED
|
@@ -1,5 +1,5 @@
|
|
| 1 |
-
API_URL=
|
| 2 |
-
API_PORT=
|
| 3 |
API_NAME=local
|
| 4 |
CORS_WILDCARD=0
|
| 5 |
COOKIE_PATH=/
|
|
|
|
| 1 |
+
API_URL=your-api-url
|
| 2 |
+
API_PORT=your-api-port
|
| 3 |
API_NAME=local
|
| 4 |
CORS_WILDCARD=0
|
| 5 |
COOKIE_PATH=/
|
Dockerfile
CHANGED
|
@@ -19,16 +19,23 @@ RUN --mount=type=cache,id=pnpm,target=/pnpm/store \
|
|
| 19 |
RUN pnpm deploy --filter=@imput/cobalt-api --prod /prod/api
|
| 20 |
|
| 21 |
FROM base AS api
|
| 22 |
-
|
| 23 |
-
ENV API_URL=${API_URL}
|
| 24 |
-
ENV API_PORT=${API_PORT}
|
| 25 |
-
ENV API_NAME=local
|
| 26 |
-
ENV CORS_WILDCARD=0
|
| 27 |
-
|
| 28 |
WORKDIR /app
|
| 29 |
|
| 30 |
COPY --from=build /prod/api /app
|
| 31 |
COPY --from=build /app/.git /app/.git
|
| 32 |
|
| 33 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 34 |
CMD [ "node", "src/cobalt" ]
|
|
|
|
| 19 |
RUN pnpm deploy --filter=@imput/cobalt-api --prod /prod/api
|
| 20 |
|
| 21 |
FROM base AS api
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 22 |
WORKDIR /app
|
| 23 |
|
| 24 |
COPY --from=build /prod/api /app
|
| 25 |
COPY --from=build /app/.git /app/.git
|
| 26 |
|
| 27 |
+
# 复制.env.example并重命名为.env
|
| 28 |
+
COPY .env.example .env
|
| 29 |
+
|
| 30 |
+
# 如果ARG有值,则替换.env文件中的相应值
|
| 31 |
+
RUN if [ -n "$API_URL" ]; then \
|
| 32 |
+
sed -i "s|^API_URL=.*|API_URL=$API_URL|" .env; \
|
| 33 |
+
fi && \
|
| 34 |
+
if [ -n "$API_PORT" ]; then \
|
| 35 |
+
sed -i "s|^API_PORT=.*|API_PORT=$API_PORT|" .env; \
|
| 36 |
+
fi
|
| 37 |
+
|
| 38 |
+
# 输出.env文件内容以进行调试
|
| 39 |
+
RUN cat .env
|
| 40 |
+
|
| 41 |
CMD [ "node", "src/cobalt" ]
|
README.md
CHANGED
|
@@ -5,7 +5,6 @@ colorFrom: gray
|
|
| 5 |
colorTo: blue
|
| 6 |
sdk: docker
|
| 7 |
pinned: false
|
| 8 |
-
app_port : 9000
|
| 9 |
---
|
| 10 |
|
| 11 |
Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
|
|
|
|
| 5 |
colorTo: blue
|
| 6 |
sdk: docker
|
| 7 |
pinned: false
|
|
|
|
| 8 |
---
|
| 9 |
|
| 10 |
Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
|