Build #24
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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: Download frontend build artifacts | |
uses: dawidd6/action-download-artifact@v3 | |
with: | |
workflow: test.yml | |
name: frontend-dist | |
path: ./backend/src/public/ | |
- 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 build --squash --push -t $DOCKER_IMAGE . |