Skip to content

Commit

Permalink
Update test_build.yml
Browse files Browse the repository at this point in the history
  • Loading branch information
SubhedarV authored Sep 25, 2024
1 parent c19d373 commit 0c01be2
Showing 1 changed file with 27 additions and 37 deletions.
64 changes: 27 additions & 37 deletions .github/workflows/test_build.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Build Docker Imageee
name: test build arg

on:
workflow_dispatch:
Expand All @@ -8,39 +8,29 @@ jobs:
runs-on: [self-hosted, Ubuntu-22.04]

steps:
- name: Checkout repository
uses: actions/checkout@v3

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

- name: Copy RPM, Dockerfile, and auto_setup.sh
run: |
mkdir -p ./docker-build
cp /scratch/ghe-runners/3/_work/preflight-check/preflight-check/833/Dockerfile/xrt_202410.2.17.833_8.1.1911-x86_64-xrt.rpm ./docker-build/
cp /scratch/ghe-runners/3/_work/preflight-check/preflight-check/833/Dockerfile/Dockerfile ./docker-build/
cp /scratch/ghe-runners/3/_work/preflight-check/preflight-check/833/Dockerfile/auto_setup.sh ./docker-build/
- name: Verify copied files
run: |
echo "Contents of docker-build directory:"
ls -al ./docker-build
- name: Build Docker image
run: |
docker build -t xrt_image:latest ./docker-build
- name: Verify Docker image
run: |
docker run --rm xrt_image:latest rpm -qa | grep xrt
- name: Log in to Docker Hub
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}

- name: Push Docker image
run: |
docker tag xrt_image:latest yourdockerhubusername/xrt_image:latest
docker push yourdockerhubusername/xrt_image:latest
- name: Checkout code
uses: actions/checkout@v2

- name: Set up Docker Build
run: |
echo "Creating a sample Dockerfile"
mkdir -p dockerfiless/Dockerfile
cat <<EOF > dockerfiles/Dockerfile/Dockerfile
ARG BASE_IMAGE
FROM \${BASE_IMAGE}
ARG TEST_ARG
RUN echo "Test argument: \${TEST_ARG}"
RUN echo "Base image: \${BASE_IMAGE}"
EOF

- name: Build Docker image
run: |
base_image="ubuntu:20.04" # Change this to test different base images
echo "Building Docker image with base image: $base_image"
docker build --build-arg BASE_IMAGE="$base_image" --build-arg TEST_ARG="HelloWorld" -t test_image -f dockerfiles/Dockerfile/Dockerfile dockerfiles/Dockerfile
- name: Run Docker image
run: |
echo "Running Docker image to check output"
docker run --rm test_image

0 comments on commit 0c01be2

Please sign in to comment.