Skip to content

Build

Build #12

Workflow file for this run

name: Build
on:
workflow_run:
workflows: ["Test"]
types:
- completed
jobs:
###############################################################
## Build Docker Image
###############################################################
build:
runs-on: ubuntu-latest
if: ${{ github.event.workflow_run.conclusion == 'success' && github.ref == 'refs/heads/development' }}
env:
DOCKER_USERNAME: ${{ secrets.DOCKER_USERNAME }}
DOCKER_PASSWORD: ${{ secrets.DOCKER_PASSWORD }}
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Login to Docker Hub
uses: docker/login-action@v2
with:
username: ${{ env.DOCKER_USERNAME }}
password: ${{ env.DOCKER_PASSWORD }}
- name: Build and push Docker image
working-directory: ./backend
run: |
COMMIT_SHORT_SHA=$(echo "${{ github.sha }}" | cut -c1-7)
DOCKER_IMAGE=docker.io/promptengineers/llm-server:${COMMIT_SHORT_SHA}
echo "Building image: $DOCKER_IMAGE"
# docker buildx build --platform linux/amd64,linux/arm64 --push -t $DOCKER_IMAGE .
docker build --squash --push -t $DOCKER_IMAGE .