Skip to content

Commit

Permalink
workflow for build and push image to GHCR
Browse files Browse the repository at this point in the history
  • Loading branch information
PragatiSukhija committed Oct 12, 2024
1 parent 478f656 commit 5bd3e4d
Show file tree
Hide file tree
Showing 2 changed files with 40 additions and 34 deletions.
52 changes: 18 additions & 34 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -1,52 +1,36 @@
name: Build CI Pipeline
name: Build and Push Docker Image to GHCR

on:
push:
branches:
- main
pull_request:
branches:
- main
workflow_dispatch:

jobs:
build:
runs-on: ubuntu-latest

steps:
- name: Checkout code
- name: Checkout repository
uses: actions/checkout@v2

# Set up Node.js environment
- name: Set up Node.js
uses: actions/setup-node@v2
with:
node-version: '14'

# Install and build the frontend
- name: Install and build frontend
run: |
cd ui/frontend
yarn install
yarn run build
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1

# Set up Rust environment
- name: Set up Rust
uses: actions-rs/toolchain@v1
- name: Log in to GitHub Container Registry
uses: docker/login-action@v2
with:
toolchain: stable
default: true
override: true
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.TOKEN }}

# Build Rust server
- name: Build Rust server
run: |
cd ui
cargo build --release
- name: Build and push Docker image
uses: docker/build-push-action@v2
with:
context: .
push: true
tags: ghcr.io/GITHUB_USERNAME/nullaway-sandbox:latest

# Build the compiler containers
- name: Build compiler tools
- name: Verify image
run: |
cd compiler
chmod +x build.sh
./build.sh
docker pull ghcr.io/GITHUB_USERNAME/nullaway-sandbox:latest
22 changes: 22 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
# Updated Dockerfile
FROM node:14 AS frontend

WORKDIR /app

# Copy the repository code (from GitHub Actions checkout)
COPY . /app

# Build backend
WORKDIR /app/NullAway-Sandbox/compiler
RUN ./build.sh

# Build frontend
WORKDIR /app/NullAway-Sandbox/ui/frontend
RUN yarn && yarn run watch

# Build Rust server
WORKDIR /app/NullAway-Sandbox/ui
RUN cargo build --release

EXPOSE 8000
CMD ["cargo", "run"]

0 comments on commit 5bd3e4d

Please sign in to comment.