|
| 1 | +name: 'Torch-TRT Docker' |
| 2 | + |
| 3 | +on: |
| 4 | + pull_request: |
| 5 | + types: [opened, synchronize, ready_for_review, review_requested, reopened] |
| 6 | + |
| 7 | +##### Adapted from https://docs.github.com/en/actions/publishing-packages/publishing-docker-images |
| 8 | + |
| 9 | +# Defines two custom environment variables for the workflow. These are used for the Container registry domain, and a name for the Docker image that this workflow builds. |
| 10 | +env: |
| 11 | + REGISTRY: ghcr.io |
| 12 | + IMAGE_NAME: ${{ github.repository }} |
| 13 | + |
| 14 | +# There is a single job in this workflow. It's configured to run on the latest available version of Ubuntu. |
| 15 | +jobs: |
| 16 | + build-and-push-image: |
| 17 | + runs-on: ubuntu-22.04 |
| 18 | + # Sets the permissions granted to the `GITHUB_TOKEN` for the actions in this job. |
| 19 | + permissions: |
| 20 | + contents: read |
| 21 | + packages: write |
| 22 | + # |
| 23 | + steps: |
| 24 | + - name: Checkout repository |
| 25 | + uses: actions/checkout@v3 |
| 26 | + # Uses the `docker/login-action` action to log in to the Container registry registry using the account and password that will publish the packages. Once published, the packages are scoped to the account defined here. |
| 27 | + - name: Log in to the Container registry |
| 28 | + uses: docker/login-action@65b78e6e13532edd9afa3aa52ac7964289d1a9c1 |
| 29 | + with: |
| 30 | + registry: ${{ env.REGISTRY }} |
| 31 | + username: ${{ github.actor }} |
| 32 | + password: ${{ secrets.GITHUB_TOKEN }} |
| 33 | + |
| 34 | + # This step uses the `docker/build-push-action` action to build the image, based on your repository's `Dockerfile`. If the build succeeds, it pushes the image to GitHub Packages. |
| 35 | + # It uses the `context` parameter to define the build's context as the set of files located in the specified path. For more information, see "[Usage](https://github.com/docker/build-push-action#usage)" in the README of the `docker/build-push-action` repository. |
| 36 | + # It uses the `tags` and `labels` parameters to tag and label the image with the output from the "meta" step. |
| 37 | + - name: Build and push Docker image |
| 38 | + uses: docker/build-push-action@f2a1d5e99d037542a71f64918e516c093c6f3fc4 |
| 39 | + with: |
| 40 | + context: . |
| 41 | + push: true |
| 42 | + tags: torch_tensorrt:main |
| 43 | + file: docker/Dockerfile |
| 44 | + build-args: | |
| 45 | + TENSORRT_VERSION="8.6" |
| 46 | + CUDNN_VERSION="8.8" |
0 commit comments