Skip to content

Commit 20de994

Browse files
committed
feat(deploy): build base veadk-python image
1 parent 6188f82 commit 20de994

File tree

4 files changed

+177
-0
lines changed

4 files changed

+177
-0
lines changed
Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
# Copyright (c) 2025 Beijing Volcano Engine Technology Co., Ltd. and/or its affiliates.
2+
#
3+
# Licensed under the Apache License, Version 2.0 (the "License");
4+
# you may not use this file except in compliance with the License.
5+
# You may obtain a copy of the License at
6+
#
7+
# http://www.apache.org/licenses/LICENSE-2.0
8+
#
9+
# Unless required by applicable law or agreed to in writing, software
10+
# distributed under the License is distributed on an "AS IS" BASIS,
11+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
# See the License for the specific language governing permissions and
13+
# limitations under the License.
14+
15+
name: Push Preview Image to Volcengine Container Registry
16+
17+
on:
18+
push:
19+
branches:
20+
- main
21+
workflow_dispatch:
22+
23+
jobs:
24+
build-and-push:
25+
runs-on: ubuntu-latest
26+
27+
# To avoid forked repo execute this workflow
28+
if: github.repository == 'volcengine/veadk-python'
29+
30+
# Set global environments
31+
env:
32+
CR_URL: veadk-cn-beijing.cr.volces.com
33+
CR_NAMESPACE: veadk
34+
CR_REPO: veadk-python
35+
DOCKERFILE: docker/Dockerfile.preview
36+
# veadk-python:preview
37+
IMAGE_TAG: ${{ env.CR_URL }}/${{ env.CR_NAMESPACE }}/${{ env.CR_REPO }}:preview
38+
39+
steps:
40+
- name: Checkout code
41+
uses: actions/checkout@v4
42+
with:
43+
fetch-depth: 0
44+
45+
- name: Set up Docker Buildx
46+
uses: docker/setup-buildx-action@v3
47+
48+
- name: Login to Volcengine Container Registry
49+
run: |
50+
echo "${{ secrets.VE_CR_PASSWORD }}" | \
51+
docker login veadk-cn-beijing.cr.volces.com \
52+
-u "${{ secrets.VE_CR_USERNAME }}" \
53+
--password-stdin
54+
55+
# Specify a platform, as VeFaaS required `linux/amd64`
56+
- name: Build and push
57+
run: |
58+
docker buildx build \
59+
--file $DOCKERFILE \
60+
--tag $IMAGE_TAG \
61+
--platform linux/amd64 \
62+
--push \
63+
--cache-from=type=gha \
64+
--cache-to=type=gha,mode=max \
65+
.
Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
1+
# Copyright (c) 2025 Beijing Volcano Engine Technology Co., Ltd. and/or its affiliates.
2+
#
3+
# Licensed under the Apache License, Version 2.0 (the "License");
4+
# you may not use this file except in compliance with the License.
5+
# You may obtain a copy of the License at
6+
#
7+
# http://www.apache.org/licenses/LICENSE-2.0
8+
#
9+
# Unless required by applicable law or agreed to in writing, software
10+
# distributed under the License is distributed on an "AS IS" BASIS,
11+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
# See the License for the specific language governing permissions and
13+
# limitations under the License.
14+
15+
name: Push Stable Image to Volcengine Container Registry
16+
17+
on:
18+
push:
19+
# Trigger only when creating tags
20+
tags:
21+
- '*'
22+
workflow_dispatch:
23+
24+
jobs:
25+
build-and-push:
26+
runs-on: ubuntu-latest
27+
28+
# To avoid forked repo execute this workflow
29+
if: github.repository == 'volcengine/veadk-python'
30+
31+
# Set global environments
32+
env:
33+
CR_URL: veadk-cn-beijing.cr.volces.com
34+
CR_NAMESPACE: veadk
35+
CR_REPO: veadk-python
36+
DOCKERFILE: docker/Dockerfile.stable
37+
# veadk-python:latest
38+
LATEST_TAG: ${{ env.CR_URL }}/${{ env.CR_NAMESPACE }}/${{ env.CR_REPO }}:latest
39+
# veadk-python:x.x.x
40+
VERSION_TAG: ${{ env.CR_URL }}/${{ env.CR_NAMESPACE }}/${{ env.CR_REPO }}:${{ github.ref_name }}
41+
42+
steps:
43+
- name: Checkout code
44+
uses: actions/checkout@v4
45+
with:
46+
fetch-depth: 0
47+
48+
- name: Set up Docker Buildx
49+
uses: docker/setup-buildx-action@v3
50+
51+
- name: Login to Volcengine Container Registry
52+
run: |
53+
echo "${{ secrets.VE_CR_PASSWORD }}" | \
54+
docker login veadk-cn-beijing.cr.volces.com \
55+
-u "${{ secrets.VE_CR_USERNAME }}" \
56+
--password-stdin
57+
58+
# Specify a platform, as VeFaaS required `linux/amd64`
59+
# push 2 tags (x.x.x and latest) in one push
60+
- name: Build and push
61+
run: |
62+
docker buildx build \
63+
--file $DOCKERFILE \
64+
--tag $VERSION_TAG \
65+
--tag $LATEST_TAG \
66+
--platform linux/amd64 \
67+
--push \
68+
--cache-from=type=gha \
69+
--cache-to=type=gha,mode=max \
70+
.

docker/Dockerfile.preview

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
# Copyright (c) 2025 Beijing Volcano Engine Technology Co., Ltd. and/or its affiliates.
2+
#
3+
# Licensed under the Apache License, Version 2.0 (the "License");
4+
# you may not use this file except in compliance with the License.
5+
# You may obtain a copy of the License at
6+
#
7+
# http://www.apache.org/licenses/LICENSE-2.0
8+
#
9+
# Unless required by applicable law or agreed to in writing, software
10+
# distributed under the License is distributed on an "AS IS" BASIS,
11+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
# See the License for the specific language governing permissions and
13+
# limitations under the License.
14+
15+
FROM python:3.12
16+
17+
# Install git and install veadk-python via git
18+
RUN apt-get install -y git && \
19+
pip3 install --no-cache-dir git+https://github.com/volcengine/veadk-python.git && \
20+
apt-get clean && rm -rf /var/lib/apt/lists/*

docker/Dockerfile.stable

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
# Copyright (c) 2025 Beijing Volcano Engine Technology Co., Ltd. and/or its affiliates.
2+
#
3+
# Licensed under the Apache License, Version 2.0 (the "License");
4+
# you may not use this file except in compliance with the License.
5+
# You may obtain a copy of the License at
6+
#
7+
# http://www.apache.org/licenses/LICENSE-2.0
8+
#
9+
# Unless required by applicable law or agreed to in writing, software
10+
# distributed under the License is distributed on an "AS IS" BASIS,
11+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
# See the License for the specific language governing permissions and
13+
# limitations under the License.
14+
15+
FROM python:3.12
16+
17+
# In order to avoid PyPI not update VeADK new package,
18+
# we still use git code to build image here.
19+
# TODO: use PyPI source
20+
RUN apt-get install -y git && \
21+
pip3 install --no-cache-dir git+https://github.com/volcengine/veadk-python.git && \
22+
apt-get clean && rm -rf /var/lib/apt/lists/*

0 commit comments

Comments
 (0)