[CI] Seperate test case with CI #50
This file contains hidden or 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: Docker Base Image CI | |
| on: | |
| push: | |
| branches: [ "master" ] | |
| jobs: | |
| build: | |
| runs-on: self-hosted | |
| permissions: | |
| contents: read | |
| packages: write | |
| attestations: write | |
| id-token: write | |
| steps: | |
| # Step 1: Checkout the repository | |
| - name: Checkout Code | |
| uses: actions/checkout@v4 | |
| # Step 2: Log in to GitHub Container Registry | |
| - name: Log in to GitHub Container Registry | |
| uses: docker/login-action@v3 | |
| with: | |
| registry: ghcr.io | |
| username: ${{ github.actor }} | |
| password: ${{ secrets.GITHUB_TOKEN }} | |
| # Step 3: Check if the Base Image Exists | |
| - name: Check if Base Image Exists | |
| id: check-image | |
| run: | | |
| if docker pull ghcr.io/psal-postech/torchsim_base:latest; then | |
| echo "Base image already exists. Skipping build and push." | |
| echo "exists=true" >> $GITHUB_ENV | |
| else | |
| echo "Base image does not exist. Proceeding with build and push." | |
| echo "exists=false" >> $GITHUB_ENV | |
| fi | |
| # Step 4: Build and Push Docker Image | |
| - name: Build and Push Docker Image | |
| if: env.exists == 'false' | |
| uses: docker/build-push-action@v4 | |
| with: | |
| context: . | |
| file: ./Dockerfile.base | |
| push: true | |
| tags: ghcr.io/psal-postech/torchsim_base:latest |