Skip to content

Custom Image

Custom Image #228

Workflow file for this run

name: Custom Image
on:
workflow_dispatch:
inputs:
name:
description: 'Name'
required: true
type: string
docker_type:
description: 'Type'
required: true
type: choice
default: 'with_model'
options:
- with_model
- with_model_arm
- without_models
- without_models_arm
permissions:
packages: write
contents: write
jobs:
with_model:
if: github.event.inputs.docker_type == 'with_model'
runs-on: x64linux
environment: Deploys
steps:
- name: Set Up Python
uses: actions/setup-python@v2
with:
python-version: 3.8
- uses: actions/checkout@v3
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
with:
platforms: linux/amd64,linux/arm64
- name: Adding required env vars for caching Docker build
uses: actions/github-script@v7
env:
github-token: ${{ secrets.GITHUB_TOKEN }}
with:
script: |
core.exportVariable('ACTIONS_CACHE_URL', process.env['ACTIONS_CACHE_URL'])
core.exportVariable('ACTIONS_RUNTIME_TOKEN', process.env['ACTIONS_RUNTIME_TOKEN'])
core.exportVariable('ACTIONS_RUNTIME_URL', process.env['ACTIONS_RUNTIME_URL'])
- name: Echo required env vars
shell: bash
run: |
echo "ACTIONS_CACHE_URL: $ACTIONS_CACHE_URL"
echo "ACTIONS_RUNTIME_TOKEN: $ACTIONS_RUNTIME_TOKEN"
echo "ACTIONS_RUNTIME_URL: $ACTIONS_RUNTIME_URL"
- name: Login to Docker Hub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Run Version Bump Script
env:
VERSION: ${{ inputs.name }}
run: python dev_bump.py $VERSION
- name: Build and Publish Docker Images
env:
VERSION: ${{ inputs.name }}
run: |
echo "${{ secrets.GITHUB_TOKEN }}" | docker login ghcr.io -u "${{ github.actor }}" --password-stdin
git fetch
cd ..
if [ -d models ]; then rm -r models; fi
mkdir models
docker buildx build --platform linux/amd64 -f Server/Dockerfile --push -t upsonic/on-prem_test:$VERSION-AMD64 \
--cache-to type=gha,mode=max \
--cache-from type=gha .
with_model_arm:
if: github.event.inputs.docker_type == 'with_model_arm'
runs-on: armlinux
environment: Deploys
steps:
- name: Set Up Python
uses: actions/setup-python@v2
with:
python-version: 3.8
- uses: actions/checkout@v3
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
with:
platforms: linux/amd64,linux/arm64
- name: Adding required env vars for caching Docker build
uses: actions/github-script@v7
env:
github-token: ${{ secrets.GITHUB_TOKEN }}
with:
script: |
core.exportVariable('ACTIONS_CACHE_URL', process.env['ACTIONS_CACHE_URL'])
core.exportVariable('ACTIONS_RUNTIME_TOKEN', process.env['ACTIONS_RUNTIME_TOKEN'])
core.exportVariable('ACTIONS_RUNTIME_URL', process.env['ACTIONS_RUNTIME_URL'])
- name: Echo required env vars
shell: bash
run: |
echo "ACTIONS_CACHE_URL: $ACTIONS_CACHE_URL"
echo "ACTIONS_RUNTIME_TOKEN: $ACTIONS_RUNTIME_TOKEN"
echo "ACTIONS_RUNTIME_URL: $ACTIONS_RUNTIME_URL"
- name: Login to Docker Hub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Run Version Bump Script
env:
VERSION: ${{ inputs.name }}
run: python dev_bump.py $VERSION
- name: Build and Publish Docker Images
env:
VERSION: ${{ inputs.name }}
run: |
echo "${{ secrets.GITHUB_TOKEN }}" | docker login ghcr.io -u "${{ github.actor }}" --password-stdin
git fetch
cd ..
if [ -d models ]; then rm -r models; fi
mkdir models
docker buildx build --platform linux/arm64 -f Server/Dockerfile --push -t upsonic/on-prem_test:$VERSION-ARM64 \
--cache-to type=gha,mode=max \
--cache-from type=gha .
without_models:
if: github.event.inputs.docker_type == 'without_models'
runs-on: x64linux
environment: Deploys
steps:
- name: Set Up Python
uses: actions/setup-python@v2
with:
python-version: 3.8
- uses: actions/checkout@v3
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
with:
platforms: linux/amd64,linux/arm64
- name: Adding required env vars for caching Docker build
uses: actions/github-script@v7
env:
github-token: ${{ secrets.GITHUB_TOKEN }}
with:
script: |
core.exportVariable('ACTIONS_CACHE_URL', process.env['ACTIONS_CACHE_URL'])
core.exportVariable('ACTIONS_RUNTIME_TOKEN', process.env['ACTIONS_RUNTIME_TOKEN'])
core.exportVariable('ACTIONS_RUNTIME_URL', process.env['ACTIONS_RUNTIME_URL'])
- name: Echo required env vars
shell: bash
run: |
echo "ACTIONS_CACHE_URL: $ACTIONS_CACHE_URL"
echo "ACTIONS_RUNTIME_TOKEN: $ACTIONS_RUNTIME_TOKEN"
echo "ACTIONS_RUNTIME_URL: $ACTIONS_RUNTIME_URL"
- name: Login to Docker Hub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Run Version Bump Script
env:
VERSION: ${{ inputs.name }}
run: python dev_bump.py $VERSION
- name: Build and Publish Docker Images
env:
VERSION: ${{ inputs.name }}
run: |
echo "${{ secrets.GITHUB_TOKEN }}" | docker login ghcr.io -u "${{ github.actor }}" --password-stdin
git fetch
cd ..
if [ -d models ]; then rm -r models; fi
mkdir models
docker buildx build --platform linux/amd64 -f Server/Dockerfile.without_models --push -t upsonic/on-prem_without_models_test:$VERSION-AMD64 \
--cache-to type=gha,mode=max \
--cache-from type=gha .
without_models_arm:
if: github.event.inputs.docker_type == 'without_models_arm'
runs-on: armlinux
environment: Deploys
steps:
- name: Set Up Python
uses: actions/setup-python@v2
with:
python-version: 3.8
- uses: actions/checkout@v3
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
with:
platforms: linux/amd64,linux/arm64
- name: Adding required env vars for caching Docker build
uses: actions/github-script@v7
env:
github-token: ${{ secrets.GITHUB_TOKEN }}
with:
script: |
core.exportVariable('ACTIONS_CACHE_URL', process.env['ACTIONS_CACHE_URL'])
core.exportVariable('ACTIONS_RUNTIME_TOKEN', process.env['ACTIONS_RUNTIME_TOKEN'])
core.exportVariable('ACTIONS_RUNTIME_URL', process.env['ACTIONS_RUNTIME_URL'])
- name: Echo required env vars
shell: bash
run: |
echo "ACTIONS_CACHE_URL: $ACTIONS_CACHE_URL"
echo "ACTIONS_RUNTIME_TOKEN: $ACTIONS_RUNTIME_TOKEN"
echo "ACTIONS_RUNTIME_URL: $ACTIONS_RUNTIME_URL"
- name: Login to Docker Hub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Run Version Bump Script
env:
VERSION: ${{ inputs.name }}
run: python dev_bump.py $VERSION
- name: Build and Publish Docker Images
env:
VERSION: ${{ inputs.name }}
run: |
echo "${{ secrets.GITHUB_TOKEN }}" | docker login ghcr.io -u "${{ github.actor }}" --password-stdin
git fetch
cd ..
if [ -d models ]; then rm -r models; fi
mkdir models
docker buildx build --platform linux/arm64 -f Server/Dockerfile.without_models --push -t upsonic/on-prem_without_models_test:$VERSION-ARM64 \
--cache-to type=gha,mode=max \
--cache-from type=gha .