diff --git a/.github/Dockerfile.latest b/.github/Dockerfile.latest new file mode 100644 index 00000000..1a717e83 --- /dev/null +++ b/.github/Dockerfile.latest @@ -0,0 +1,20 @@ +# Copyright (c) 2025 Beijing Volcano Engine Technology Co., Ltd. and/or its affiliates. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +FROM python:3.12 + +# Install git and install veadk-python via git +RUN apt-get install -y git && \ + pip3 install --no-cache-dir git+https://github.com/volcengine/veadk-python.git && \ + apt-get clean && rm -rf /var/lib/apt/lists/* diff --git a/.github/Dockerfile.preview b/.github/Dockerfile.preview new file mode 100644 index 00000000..1a717e83 --- /dev/null +++ b/.github/Dockerfile.preview @@ -0,0 +1,20 @@ +# Copyright (c) 2025 Beijing Volcano Engine Technology Co., Ltd. and/or its affiliates. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +FROM python:3.12 + +# Install git and install veadk-python via git +RUN apt-get install -y git && \ + pip3 install --no-cache-dir git+https://github.com/volcengine/veadk-python.git && \ + apt-get clean && rm -rf /var/lib/apt/lists/* diff --git a/.github/workflows/latest-image-to-ark-cr.yaml b/.github/workflows/latest-image-to-ark-cr.yaml new file mode 100644 index 00000000..b7f41792 --- /dev/null +++ b/.github/workflows/latest-image-to-ark-cr.yaml @@ -0,0 +1,64 @@ +# Copyright (c) 2025 Beijing Volcano Engine Technology Co., Ltd. and/or its affiliates. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +name: Push Latest Image to ARK Registry + +on: + push: + # Trigger only when pushing tags + tags: + - '*' + workflow_dispatch: + +jobs: + build-and-push: + runs-on: ubuntu-latest + # This job is executed only when the repository is the main repository. + if: github.repository == 'volcengine/veadk-python' + steps: + - name: Checkout code + uses: actions/checkout@v4 + with: + fetch-depth: 0 + + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v3 + + - name: Login to Volcengine Container Registry + uses: docker/login-action@v3 + with: + registry: veadk-cn-beijing.cr.volces.com + username: ${{ secrets.ARK_CR_USERNAME }} + password: ${{ secrets.ARK_CR_PASSWORD }} + + - name: Extract metadata + id: meta + uses: docker/metadata-action@v5 + with: + images: veadk-cn-beijing.cr.volces.com/veadk/veadk-python + tags: | + latest + type=ref,event=tag + + + - name: Build and push + uses: docker/build-push-action@v5 + with: + context: . + file: .github/Dockerfile.latest + push: true + tags: ${{ steps.meta.outputs.tags }} + labels: ${{ steps.meta.outputs.labels }} + cache-from: type=gha + cache-to: type=gha,mode=max \ No newline at end of file diff --git a/.github/workflows/preview-image-to-ark-cr.yaml b/.github/workflows/preview-image-to-ark-cr.yaml new file mode 100644 index 00000000..206f68b7 --- /dev/null +++ b/.github/workflows/preview-image-to-ark-cr.yaml @@ -0,0 +1,60 @@ +# Copyright (c) 2025 Beijing Volcano Engine Technology Co., Ltd. and/or its affiliates. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +name: Push Preview Image to ARK Registry + +on: + push: + branches: [ main ] + workflow_dispatch: + +jobs: + build-and-push: + runs-on: ubuntu-latest + # This job is executed only when the repository is the main repository. + if: github.repository == 'volcengine/veadk-python' + steps: + - name: Checkout code + uses: actions/checkout@v4 + with: + fetch-depth: 0 + + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v3 + + - name: Login to Volcengine Container Registry + uses: docker/login-action@v3 + with: + registry: veadk-cn-beijing.cr.volces.com + username: ${{ secrets.ARK_CR_USERNAME }} + password: ${{ secrets.ARK_CR_PASSWORD }} + + - name: Extract metadata + id: meta + uses: docker/metadata-action@v5 + with: + images: veadk-cn-beijing.cr.volces.com/veadk/veadk-python + tags: | + preview + + - name: Build and push + uses: docker/build-push-action@v5 + with: + context: . + file: .github/Dockerfile.preview + push: true + tags: ${{ steps.meta.outputs.tags }} + labels: ${{ steps.meta.outputs.labels }} + cache-from: type=gha + cache-to: type=gha,mode=max \ No newline at end of file