Skip to content

Commit d08aac9

Browse files
feat(deploy): build base veadk-python image (#134)
* feat(deploy): build base veadk-python image * fix env combine * fix env combine * add permissions * fix typo
1 parent 6188f82 commit d08aac9

File tree

4 files changed

+179
-0
lines changed

4 files changed

+179
-0
lines changed
Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
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+
permissions:
18+
contents: read
19+
20+
on:
21+
push:
22+
branches:
23+
- main
24+
workflow_dispatch:
25+
26+
jobs:
27+
build-and-push:
28+
runs-on: ubuntu-latest
29+
30+
# To avoid forked repo execute this workflow
31+
if: github.repository == 'volcengine/veadk-python'
32+
33+
# Set global environments
34+
env:
35+
CR_URL: veadk-cn-beijing.cr.volces.com
36+
CR_NAMESPACE: veadk
37+
CR_REPO: veadk-python
38+
DOCKERFILE: docker/Dockerfile.preview
39+
40+
steps:
41+
- name: Checkout code
42+
uses: actions/checkout@v4
43+
with:
44+
fetch-depth: 0
45+
46+
- name: Set up Docker Buildx
47+
uses: docker/setup-buildx-action@v3
48+
49+
- name: Login to Volcengine Container Registry
50+
run: |
51+
echo "${{ secrets.VE_CR_PASSWORD }}" | \
52+
docker login veadk-cn-beijing.cr.volces.com \
53+
-u "${{ secrets.VE_CR_USERNAME }}" \
54+
--password-stdin
55+
56+
# Specify a platform, as VeFaaS required `linux/amd64`
57+
- name: Build and push
58+
run: |
59+
IMAGE_TAG=$CR_URL/$CR_NAMESPACE/$CR_REPO:preview
60+
docker buildx build \
61+
--file $DOCKERFILE \
62+
--tag $IMAGE_TAG \
63+
--platform linux/amd64 \
64+
--push \
65+
--cache-from=type=gha \
66+
--cache-to=type=gha,mode=max \
67+
.
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+
permissions:
28+
contents: read
29+
30+
# To avoid forked repo execute this workflow
31+
if: github.repository == 'volcengine/veadk-python'
32+
33+
# Set global environments
34+
env:
35+
CR_URL: veadk-cn-beijing.cr.volces.com
36+
CR_NAMESPACE: veadk
37+
CR_REPO: veadk-python
38+
DOCKERFILE: docker/Dockerfile.stable
39+
40+
steps:
41+
- name: Checkout code
42+
uses: actions/checkout@v4
43+
with:
44+
fetch-depth: 0
45+
46+
- name: Set up Docker Buildx
47+
uses: docker/setup-buildx-action@v3
48+
49+
- name: Login to Volcengine Container Registry
50+
run: |
51+
echo "${{ secrets.VE_CR_PASSWORD }}" | \
52+
docker login veadk-cn-beijing.cr.volces.com \
53+
-u "${{ secrets.VE_CR_USERNAME }}" \
54+
--password-stdin
55+
56+
# Specify a platform, as VeFaaS required `linux/amd64`
57+
# push 2 tags (x.x.x and latest) in one push
58+
- name: Build and push
59+
run: |
60+
LATEST_TAG=$CR_URL/$CR_NAMESPACE/$CR_REPO:latest
61+
VERSION_TAG=$CR_URL/$CR_NAMESPACE/$CR_REPO:$GITHUB_REF_NAME
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)