Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions docker/spaces/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@ echo "$OPENCSG_ACR_PASSWORD" | docker login $OPENCSG_ACR -u $OPENCSG_ACR_USERNAM
export BUILDX_NO_DEFAULT_ATTESTATIONS=1
export IMAGE_TAG=1.2
docker buildx build --platform linux/amd64,linux/arm64 \
-t ${OPENCSG_ACR}/opencsg_space/csg-nginx:${IMAGE_TAG} \
-t ${OPENCSG_ACR}/opencsg_space/csg-nginx:latest \
-t ${OPENCSG_ACR}/opencsghq/csg-nginx:${IMAGE_TAG} \
-t ${OPENCSG_ACR}/opencsghq/csg-nginx:latest \
-f Dockerfile.nginx \
--push .
```
Expand Down
4 changes: 2 additions & 2 deletions docker/spaces/base_images/model_chatui/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@ echo "$OPENCSG_ACR_PASSWORD" | docker login $OPENCSG_ACR -u $OPENCSG_ACR_USERNAM
export BUILDX_NO_DEFAULT_ATTESTATIONS=1
export IMAGE_TAG=1.0
docker buildx build --platform linux/amd64,linux/arm64 \
-t ${OPENCSG_ACR}/opencsg_space/vllm-cpu-chatui-base:${IMAGE_TAG} \
-t ${OPENCSG_ACR}/opencsg_space/vllm-cpu-chatui-base:latest \
-t ${OPENCSG_ACR}/opencsghq/vllm-cpu-chatui-base:${IMAGE_TAG} \
-t ${OPENCSG_ACR}/opencsghq/vllm-cpu-chatui-base:latest \
-f Dockerfile.vllm-cpu.base \
--push .
```
Expand Down
5 changes: 3 additions & 2 deletions docker/spaces/builder/Dockerfile-nginx
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
ARG SPACE_NGINX_IMAGE=opencsg-registry.cn-beijing.cr.aliyuncs.com/opencsg_public/nginx:latest
FROM ${SPACE_NGINX_IMAGE}
ARG SPACE_BASE_IMAGE=opencsg-registry.cn-beijing.cr.aliyuncs.com
ARG NAMESPACE=opencsghq
FROM ${SPACE_BASE_IMAGE}/${NAMESPACE}/nginx:latest
WORKDIR /usr/share/nginx/html
COPY nginx.conf /etc/nginx/nginx.conf

Expand Down
25 changes: 18 additions & 7 deletions docker/spaces/builder/Dockerfile-python3.10
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
ARG SPACE_BASE_IMAGE=opencsg-registry.cn-beijing.cr.aliyuncs.com/opencsg_public/space-base:python3.10-1.0.2
ARG SPACE_BASE_IMAGE=opencsg-registry.cn-beijing.cr.aliyuncs.com
ARG NAMESPACE=opencsghq

FROM ${SPACE_BASE_IMAGE}/opencsg_public/space-base:python3.10-1.0.3 AS base
FROM ${SPACE_BASE_IMAGE}/${NAMESPACE}/space-base:python3.10-1.0.3 AS base

# First handle dependencies to leverage caching
USER user
Expand All @@ -21,14 +22,24 @@ RUN if [ -s "packages.txt" ]; then \
USER user
# Set the default domestic source (Alibaba Cloud), users can override it via --build-arg PyPI=xxx
ARG PyPI=https://mirrors.aliyun.com/pypi/simple/
RUN if [ -n "$PyPI" ]; then \
ARG ALLOW_INSECURE_PIP=false

RUN rm -rf ~/.pip ~/.config/pip && \
if [ -n "$PyPI" ]; then \
pip config set global.index-url "${PyPI}" && \
# Configure trusted sources (to avoid HTTPS certificate issues)
pip config set global.trusted-host $(echo "${PyPI}" | sed -n 's|https\?://\([^/]*\)/.*|\1|p'); \
TRUSTED_HOST=$(echo "${PyPI}" | sed -n 's|https\?://\([^/]*\)/.*|\1|p') && \
if [ -n "$TRUSTED_HOST" ]; then \
pip config set global.trusted-host "${TRUSTED_HOST}"; \
else \
echo "Error: Failed to extract trusted host from ${PyPI}" && exit 1; \
fi && \
if [[ "$PyPI" == http://* ]] || [ "$ALLOW_INSECURE_PIP" = "true" ]; then \
pip config set global.verify-ssl false; \
fi; \
fi

RUN pip install --no-cache-dir --default-timeout=60 -r pre-requirements.txt && \
pip install --no-cache-dir --default-timeout=60 -r requirements.txt
RUN pip install --default-timeout=60 -r pre-requirements.txt && \
pip install --default-timeout=60 -r requirements.txt

COPY --link --chown=1000 ./ ./

Expand Down
19 changes: 15 additions & 4 deletions docker/spaces/builder/Dockerfile-python3.10-cuda11.8.0
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
ARG SPACE_BASE_IMAGE=opencsg-registry.cn-beijing.cr.aliyuncs.com/opencsg_public/space-base:python3.10-cuda11.8.0-1.0.2
ARG SPACE_BASE_IMAGE=opencsg-registry.cn-beijing.cr.aliyuncs.com
ARG NAMESPACE=opencsghq

FROM ${SPACE_BASE_IMAGE}/opencsg_public/space-base:python3.10-cuda11.8.0-1.0.3 AS base
FROM ${SPACE_BASE_IMAGE}/${NAMESPACE}/space-base:python3.10-cuda11.8.0-1.0.3 AS base

USER user
WORKDIR /home/user/app
Expand All @@ -18,9 +19,19 @@ RUN if [ -s "packages.txt" ]; then \

USER user
ARG PyPI=https://mirrors.aliyun.com/pypi/simple/
RUN if [ -n "$PyPI" ]; then \
ARG ALLOW_INSECURE_PIP=false
RUN rm -rf ~/.pip ~/.config/pip && \
if [ -n "$PyPI" ]; then \
pip config set global.index-url "${PyPI}" && \
pip config set global.trusted-host $(echo "${PyPI}" | sed -n 's|https\?://\([^/]*\)/.*|\1|p'); \
TRUSTED_HOST=$(echo "${PyPI}" | sed -n 's|https\?://\([^/]*\)/.*|\1|p') && \
if [ -n "$TRUSTED_HOST" ]; then \
pip config set global.trusted-host "${TRUSTED_HOST}"; \
else \
echo "Error: Failed to extract trusted host from ${PyPI}" && exit 1; \
fi && \
if [[ "$PyPI" == http://* ]] || [ "$ALLOW_INSECURE_PIP" = "true" ]; then \
pip config set global.verify-ssl false; \
fi; \
fi

RUN pip install --no-cache-dir --default-timeout=60 -r pre-requirements.txt && \
Expand Down
20 changes: 15 additions & 5 deletions docker/spaces/builder/Dockerfile-python3.10-cuda12.1.0
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
ARG SPACE_BASE_IMAGE=opencsg-registry.cn-beijing.cr.aliyuncs.com/opencsg_public/space-base:python3.10-cuda12.1.0-1.0.2

FROM ${SPACE_BASE_IMAGE}/opencsg_public/space-base:python3.10-cuda12.1.0-1.0.3 AS base
ARG SPACE_BASE_IMAGE=opencsg-registry.cn-beijing.cr.aliyuncs.com
ARG NAMESPACE=opencsghq
FROM ${SPACE_BASE_IMAGE}/${NAMESPACE}/space-base:python3.10-cuda12.1.0-1.0.3 AS base

USER user
WORKDIR /home/user/app
Expand All @@ -18,9 +18,19 @@ RUN if [ -s "packages.txt" ]; then \

USER user
ARG PyPI=https://mirrors.aliyun.com/pypi/simple/
RUN if [ -n "$PyPI" ]; then \
ARG ALLOW_INSECURE_PIP=false
RUN rm -rf ~/.pip ~/.config/pip && \
if [ -n "$PyPI" ]; then \
pip config set global.index-url "${PyPI}" && \
pip config set global.trusted-host $(echo "${PyPI}" | sed -n 's|https\?://\([^/]*\)/.*|\1|p'); \
TRUSTED_HOST=$(echo "${PyPI}" | sed -n 's|https\?://\([^/]*\)/.*|\1|p') && \
if [ -n "$TRUSTED_HOST" ]; then \
pip config set global.trusted-host "${TRUSTED_HOST}"; \
else \
echo "Error: Failed to extract trusted host from ${PyPI}" && exit 1; \
fi && \
if [[ "$PyPI" == http://* ]] || [ "$ALLOW_INSECURE_PIP" = "true" ]; then \
pip config set global.verify-ssl false; \
fi; \
fi

RUN pip install --no-cache-dir --default-timeout=60 -r pre-requirements.txt && \
Expand Down
14 changes: 7 additions & 7 deletions docker/spaces/builder/base/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,15 @@
## 说明
这些 image 会被 space 中自动为用户应用生成的 Dockerfile 引用,针对不同类型,不同应用会有不同的 base image

生成基础镜像后,会推送到传神社区的 registry 中(当前是`registry.cn-beijing.aliyuncs.com`的`opencsg_space`命名空间)
生成基础镜像后,会推送到传神社区的 registry 中(当前是`registry.cn-beijing.aliyuncs.com`的`opencsghq`命名空间)

base image 命名格式如下:

`registry.cn-beijing.aliyuncs.com/opencsg_space/space-base:[python_version]-[cuda_version]`。
`registry.cn-beijing.aliyuncs.com/opencsghq/space-base:[python_version]-[cuda_version]`。

例如:
- `registry.cn-beijing.aliyuncs.com/opencsg_space/space-base:python3.10`
- `registry.cn-beijing.aliyuncs.com/opencsg_space/space-base:python3.10-cuda11.8.0`
- `registry.cn-beijing.aliyuncs.com/opencsghq/space-base:python3.10`
- `registry.cn-beijing.aliyuncs.com/opencsghq/space-base:python3.10-cuda11.8.0`

## 构建

Expand All @@ -38,7 +38,7 @@ docker buildx build \
--provenance false \
--platform linux/amd64,linux/arm64 \
-f Dockerfile-python3.10-base \
-t opencsg-registry.cn-beijing.cr.aliyuncs.com/opencsg_public/space-base:python3.10-1.0.3 \
-t opencsg-registry.cn-beijing.cr.aliyuncs.com/opencsghq/space-base:python3.10-1.0.3 \
--push .

## Python with cuda
Expand All @@ -48,7 +48,7 @@ docker buildx build \
--provenance false \
--platform linux/amd64,linux/arm64 \
-f Dockerfile-python3.10-cuda11.8.0-base \
-t opencsg-registry.cn-beijing.cr.aliyuncs.com/opencsg_public/space-base:python3.10-cuda11.8.0-1.0.3 \
-t opencsg-registry.cn-beijing.cr.aliyuncs.com/opencsghq/space-base:python3.10-cuda11.8.0-1.0.3 \
--push .

export DOCKER_BUILDKIT=1
Expand All @@ -57,6 +57,6 @@ docker buildx build \
--provenance false \
--platform linux/amd64,linux/arm64 \
-f Dockerfile-python3.10-cuda12.1.0-base \
-t opencsg-registry.cn-beijing.cr.aliyuncs.com/opencsg_public/space-base:python3.10-cuda12.1.0-1.0.3 \
-t opencsg-registry.cn-beijing.cr.aliyuncs.com/opencsghq/space-base:python3.10-cuda12.1.0-1.0.3 \
--push .
```
6 changes: 4 additions & 2 deletions docker/spaces/templates/model_chatui/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
FROM opencsg-registry.cn-beijing.cr.aliyuncs.com/opencsg_space/vllm-cpu-chatui-base:1.0
ARG SPACE_BASE_IMAGE=opencsg-registry.cn-beijing.cr.aliyuncs.com
ARG NAMESPACE=opencsghq
FROM ${SPACE_BASE_IMAGE}/${NAMESPACE}/vllm-cpu-chatui-base:1.0

WORKDIR /workspace/

Expand All @@ -17,4 +19,4 @@ ENV HUGGINGFACE_HUB_CACHE=/workspace/ \

EXPOSE 8080

ENTRYPOINT ["bash", "/etc/csghub/serve-cpu.sh"]
ENTRYPOINT ["bash", "/etc/csghub/serve-cpu.sh"]
Loading