Skip to content

Commit

Permalink
Merge pull request #29 from kartAI/feat/cd-pipeline
Browse files Browse the repository at this point in the history
build: Add  docker image push
  • Loading branch information
SverreNystad authored Oct 9, 2024
2 parents 3d1da35 + d9d46bf commit 5ae7dc4
Showing 1 changed file with 32 additions and 7 deletions.
39 changes: 32 additions & 7 deletions .github/workflows/cd.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ name: CD

on:
workflow_run:
workflows: ["CI"]
workflows: ["CI"]
types:
- completed

Expand All @@ -11,11 +11,36 @@ jobs:
runs-on: ubuntu-latest

# Only runs if CI was successful
if: ${{ github.event.workflow_run.conclusion == 'success' }}
if: ${{ github.event.workflow_run.conclusion == 'success' }}

steps:
- uses: actions/checkout@v4
- name: Build the Docker image
run: docker build . --file Dockerfile --tag ntnu-kpro-ai-assistant:$(date +%s)
# Checkout the repository
- name: Checkout code
uses: actions/checkout@v3

- name: Set up QEMU
uses: docker/setup-qemu-action@v2

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2

- name: Log in to GitHub Container Registry
uses: docker/login-action@v2
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Extract short SHA
id: git_sha
run: echo "GIT_SHA=$(git rev-parse --short $GITHUB_SHA)" >> $GITHUB_ENV

- name: Build and Push Docker Backend Image
run: |
docker build -t ghcr.io/kartai/ntnu-kpro-ai-assistant-backend:${{ env.GIT_SHA }} ./backend
docker push ghcr.io/kartai/ntnu-kpro-ai-assistant-backend:${{ env.GIT_SHA }}
- name: Push the Docker image
run: echo TODO Push the Docker image
- name: Build and Push Docker Frontend Image
run: |
docker build -t ghcr.io/kartai/ntnu-kpro-ai-assistant-frontend:${{ env.GIT_SHA }} ./frontend
docker push ghcr.io/kartai/ntnu-kpro-ai-assistant-frontend:${{ env.GIT_SHA }}

0 comments on commit 5ae7dc4

Please sign in to comment.