replace build/codegen scripts with justfile, adapt readme #32
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 and publish Docker images | |
on: | |
push: | |
branches: | |
- "main" | |
env: | |
REGISTRY: ghcr.io | |
IMAGE_NAME: ${{ github.repository }} | |
jobs: | |
frontend: | |
name: Build Frontend image | |
runs-on: ubuntu-latest | |
permissions: | |
contents: read | |
packages: write | |
steps: | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v2 | |
- name: Login to GitHub Container Registry | |
uses: docker/login-action@v2 | |
with: | |
registry: ghcr.io | |
username: ${{ github.actor }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- name: Extract Docker metadata | |
id: meta | |
uses: docker/metadata-action@98669ae865ea3cffbcbaa878cf57c20bbf1c6c38 | |
with: | |
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}-frontend | |
- name: Build and push to Github Packages | |
uses: docker/build-push-action@v2 | |
with: | |
context: "{{defaultContext}}:frontend" | |
push: true | |
tags: ${{ steps.meta.outputs.tags }} | |
labels: ${{ steps.meta.outputs.labels }} | |
ai: | |
name: Build Python service image | |
runs-on: ubuntu-latest | |
permissions: | |
contents: read | |
packages: write | |
steps: | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v2 | |
- name: Login to GitHub Container Registry | |
uses: docker/login-action@v2 | |
with: | |
registry: ghcr.io | |
username: ${{ github.actor }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- name: Extract Docker metadata | |
id: meta | |
uses: docker/metadata-action@98669ae865ea3cffbcbaa878cf57c20bbf1c6c38 | |
with: | |
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}-ai | |
- name: Build and push to Github Packages | |
uses: docker/build-push-action@v2 | |
with: | |
context: "{{defaultContext}}:imagehive-ai" | |
push: true | |
tags: ${{ steps.meta.outputs.tags }} | |
labels: ${{ steps.meta.outputs.labels }} | |
backend: | |
name: Build Micronaut backend image | |
runs-on: ubuntu-latest | |
permissions: | |
contents: read | |
packages: write | |
services: | |
postgres: | |
image: postgres | |
ports: | |
- 5432:5432 | |
env: | |
POSTGRES_PASSWORD: password | |
options: --health-cmd pg_isready | |
--health-interval 10s | |
--health-timeout 5s | |
--health-retries 5 | |
steps: | |
- uses: actions/checkout@v2 | |
- name: Set up JDK 21 | |
uses: actions/setup-java@v1 | |
with: | |
java-version: 21 | |
- name: Set up Node | |
uses: actions/setup-node@v3 | |
with: | |
node-version: 20 | |
- name: Cache Maven packages | |
uses: actions/cache@v1 | |
with: | |
path: ~/.m2 | |
key: ${{ runner.os }}-m2-${{ hashFiles('**/pom.xml') }} | |
restore-keys: ${{ runner.os }}-m2 | |
- name: Generate code and build | |
run: ./build.sh postgres postgres password | |
env: | |
IMAGEHIVE_PG_JDBC_URL: jdbc:postgresql://localhost:5432/postgres | |
IMAGEHIVE_PG_USER: postgres | |
IMAGEHIVE_PG_PASSWORD: password | |
- name: Build docker image with Maven | |
run: cd backend && ./mvnw deploy -Dpackaging=docker-native -Pgraalvm -Djib.to.image=ghcr.io/gyrosofwar/imagehive-backend:latest -Djib.to.auth.username=${{ github.actor }} -Djib.to.auth.password=${{ secrets.GITHUB_TOKEN }} | |
env: | |
IMAGEHIVE_PG_JDBC_URL: jdbc:postgresql://localhost:5432/postgres | |
IMAGEHIVE_PG_USER: postgres | |
IMAGEHIVE_PG_PASSWORD: password |