Skip to content

first commit

first commit #1

Workflow file for this run

name: Build and Deploy
on:
push:
branches:
- main
paths:
- 'app/Dockerfile'
- 'app/**'
- 'infra/tf/**'
env:
TF_VAR_civo_token: ${{ secrets.CIVO_TOKEN }}
jobs:
build-and-deploy:
runs-on: ubuntu-latest
steps:
- name: Check out the repo
uses: actions/checkout@v2
- name: Convert repository owner to lowercase
id: repo_owner
run: echo "repo_owner=$(echo ${{ github.repository_owner }} | tr '[:upper:]' '[:lower:]')" >> $GITHUB_ENV
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1
- name: Login to GitHub Container Registry
uses: docker/login-action@v1
with:
registry: ghcr.io
username: ${{ env.repo_owner }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Cache Docker layers
uses: actions/cache@v2
with:
path: /tmp/.buildx-cache
key: ${{ runner.os }}-buildx-${{ github.sha }}
restore-keys: |
${{ runner.os }}-buildx-
- name: Build and push Docker image
uses: docker/build-push-action@v2
with:
context: ./app
file: ./app/Dockerfile
push: true
tags: ghcr.io/${{ env.repo_owner }}/llm-boilerplate-app:latest
cache-from: type=local,src=/tmp/.buildx-cache
cache-to: type=local,dest=/tmp/.buildx-cache-new
secrets: |
GIT_AUTH_TOKEN=${{ secrets.GITHUB_TOKEN }}
- name: Move Docker cache
run: |
rm -rf /tmp/.buildx-cache
mv /tmp/.buildx-cache-new /tmp/.buildx-cache
- name: Setup Terraform
uses: hashicorp/setup-terraform@v1
with:
terraform_version: 1.0.0
- name: Terraform Init
run: terraform -chdir=infra/tf/ init -upgrade
- name: Terraform Plan
run: terraform -chdir=infra/tf/ plan -no-color -out=tfplan
continue-on-error: true
- name: Terraform Apply
run: terraform -chdir=infra/tf/ apply -auto-approve