FIX remove stdin in docker #6
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
| # Test that the docker image builds correctly | |
| # and that running the ingestion and scoring programs works | |
| # Also use cache for the data and the docker image. | |
| name: Test Docker Image | |
| on: | |
| push: | |
| branches: [ main ] | |
| pull_request: | |
| jobs: | |
| test: | |
| runs-on: ubuntu-latest | |
| env: | |
| DOCKER_IMAGE_NAME: docker-codabench-test | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v3 | |
| - name: Set up Docker Buildx | |
| uses: docker/setup-buildx-action@v3 | |
| - name: Cache Docker buildx layers | |
| uses: actions/cache@v3 | |
| with: | |
| path: ${{ runner.temp }}/.buildx-cache | |
| key: buildx-${{ hashFiles('**/Dockerfile') }} | |
| restore-keys: | | |
| buildx-${{ hashFiles('**/Dockerfile') }} | |
| - name: Docker build | |
| uses: docker/build-push-action@v6 | |
| with: | |
| push: false | |
| tags: ${{ env.DOCKER_IMAGE_NAME }} | |
| cache-from: type=local,src=${{ runner.temp }}/.buildx-cache | |
| cache-to: type=local,dest=${{ runner.temp }}/.buildx-cache-new,mode=max | |
| - name: Clean docker cache to avoid large growth | |
| run: | | |
| rm -rf ${{ runner.temp }}/.buildx-cache | |
| mv ${{ runner.temp }}/.buildx-cache-new ${{ runner.temp }}/.buildx-cache | |
| - uses: actions/setup-python@main | |
| with: | |
| python-version: '3.12' | |
| pip-install: -r requirements.txt | |
| cache: 'pip' # caching pip dependencies | |
| - name: Prepare input/output directories (per README) | |
| run: | | |
| pip install -r requirements.txt | |
| python setup_data.py | |
| - name: Test ingestion program | |
| run: | | |
| docker run --rm -u root \ | |
| -v "./ingestion_program":"/app/ingestion_program" \ | |
| -v "./dev_phase/input_data":/app/input_data \ | |
| -v "./ingestion_res":/app/output \ | |
| -v "./solution":/app/ingested_program \ | |
| --name ingestion ${{ env.DOCKER_IMAGE_NAME }} \ | |
| python /app/ingestion_program/ingestion.py | |
| - name: Test scoring program | |
| run: docker run --rm -u root \ | |
| -v "./scoring_program":"/app/scoring_program" \ | |
| -v "./dev_phase/reference_data":/app/input/ref \ | |
| -v "./ingestion_res":/app/input/res \ | |
| -v "./scoring_res":/app/output \ | |
| --name scoring ${{ env.DOCKER_IMAGE_NAME }} \ | |
| python /app/scoring_program/scoring.py |