Skip to content

Create main.yml

Create main.yml #1

Workflow file for this run

name: CI Pipeline
on:
push:
branches:
- main
pull_request:
branches:
- main
jobs:
build:
runs-on: ubuntu-20.04
steps:
# Step 1: Checkout the repository
- name: Checkout Repository
uses: actions/checkout@v3
# Step 2: Set up Docker Buildx
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
# Step 3: Cache Docker layers to speed up builds
- name: Cache Docker layers
uses: actions/cache@v3
with:
path: /tmp/.buildx-cache
key: ubuntu-20.04-buildx-${{ github.ref }}
restore-keys: |
${{ runner.os }}-buildx-
# Step 4: Build Docker Image
- name: Build Docker Image
uses: docker/build-push-action@v4
with:
context: .
push: false
tags: bidder-node-docker:latest
cache-from: type=local,src=/tmp/.buildx-cache
cache-to: type=local,dest=/tmp/.buildx-cache-new
# Step 5: Move Cache
- name: Move Cache
run: |
rm -rf /tmp/.buildx-cache
mv /tmp/.buildx-cache-new /tmp/.buildx-cache
# # Step 6: Run Tests (Optional)
# - name: Run Tests
# run: |
# # Example: Run your test script or commands
# # Replace with actual test commands relevant to your project
# docker run --rm bidder-node-docker:latest /bin/bash -c "echo Running tests && exit 0"