Skip to content
This repository has been archived by the owner on Oct 21, 2024. It is now read-only.

Commit

Permalink
tf infra, build image locally
Browse files Browse the repository at this point in the history
  • Loading branch information
Xtrah committed Sep 9, 2024
1 parent 1aab4a6 commit 2039568
Show file tree
Hide file tree
Showing 13 changed files with 216 additions and 262 deletions.
1 change: 1 addition & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# big-AGI non-code files
/docs/
/dist/
/infra/
README.md

# Ignore build and log files
Expand Down
32 changes: 0 additions & 32 deletions .github/ISSUE_TEMPLATE/bug_report.yml

This file was deleted.

132 changes: 0 additions & 132 deletions .github/ISSUE_TEMPLATE/maintainers-release.md

This file was deleted.

18 changes: 0 additions & 18 deletions .github/ISSUE_TEMPLATE/roadmap-request.md

This file was deleted.

28 changes: 28 additions & 0 deletions .github/workflows/build-push-docker.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
name: Build and Push to ACR
on:
push:
branches:
- 'main'
jobs:
build:
name: 'Build and Push to ACR'
runs-on: ubuntu-latest

defaults:
run:
shell: bash

steps:
- uses: actions/checkout@v4

- uses: docker/login-action@v3
with:
registry: ${{ secrets.DOCKER_REGISTRY_SERVER_URL }}
username: ${{ secrets.DOCKER_REGISTRY_SERVER_USERNAME }}
password: ${{ secrets.DOCKER_REGISTRY_SERVER_PASSWORD }}

- uses: docker/build-push-action@v6
with:
push: true
tags: ${{ secrets.DOCKER_REGISTRY_SERVER_URL }}/kantega-big-agi:latest
file: Dockerfile
69 changes: 0 additions & 69 deletions .github/workflows/docker-image.yml

This file was deleted.

5 changes: 5 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,11 @@ yarn-error.log*
# local env files
.env
.env.*
terraform.tfvars

# terraform
.terraform*
terraform.tfstate*

# vercel
.vercel
Expand Down
27 changes: 23 additions & 4 deletions docker-compose.yaml
Original file line number Diff line number Diff line change
@@ -1,14 +1,33 @@
# Very simple docker-compose file to run the app on http://localhost:3000 (or http://127.0.0.1:3000).
# This file is used to run `big-AGI` and `browserless` with Docker Compose.
#
# For more examples, such runnin big-AGI alongside a web browsing service, see the `docs/docker` folder.
# The two containers are linked together and `big-AGI` is configured to use `browserless`
# as its Puppeteer endpoint (from the containers intranet, it is available browserless:3000).
#
# From your host, you can access big-AGI on http://127.0.0.1:3000 and browserless on http://127.0.0.1:9222.
#
# To start the containers, run:
# docker-compose -f docs/docker/docker-compose-browserless.yaml up

version: '3.9'

services:
big-agi:
image: ghcr.io/enricoros/big-agi:latest
build:
context: .
dockerfile: Dockerfile
ports:
- "3000:3000"
env_file:
- .env
command: [ "next", "start", "-p", "3000" ]
environment:
- PUPPETEER_WSS_ENDPOINT=ws://browserless:3000
command: [ "next", "start", "-p", "3000" ]
depends_on:
- browserless

browserless:
image: browserless/chrome:latest
ports:
- "9222:3000" # Map host's port 9222 to container's port 3000
environment:
- MAX_CONCURRENT_SESSIONS=10
32 changes: 32 additions & 0 deletions infra/build.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
resource "null_resource" "docker_build" {
triggers = {
always_run = "${timestamp()}"
}

provisioner "local-exec" {
command = <<EOT
cd "${path.module}/.."
az acr login --name ${azurerm_container_registry.acr.name}
if ! docker version > /dev/null 2>&1; then
echo "Docker is not running. Please start Docker and try again."
exit 1
fi
# Create a temporary Buildx builder with docker-container driver
BUILDER_NAME=temp-builder-$(date +%s)
docker buildx create --name $BUILDER_NAME --use --driver docker-container
docker image remove ${azurerm_container_registry.acr.login_server}/${var.project_name}:latest || true
az acr repository delete --name ${azurerm_container_registry.acr.name} --image ${var.project_name}:latest --yes || true
docker buildx build --platform linux/amd64,linux/arm64 -t ${azurerm_container_registry.acr.login_server}/${var.project_name}:latest --push .
# Clean up the temporary builder
docker buildx rm $BUILDER_NAME
EOT
}

depends_on = [azurerm_container_registry.acr]
}
Loading

0 comments on commit 2039568

Please sign in to comment.