Skip to content

Commit 996b0a7

Browse files
committed
Sample Docker Push Action
1 parent 6920876 commit 996b0a7

File tree

1 file changed

+45
-0
lines changed

1 file changed

+45
-0
lines changed

.github/workflows/docker_builder.yml

+45
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
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-latest
18+
# Sets the permissions granted to the `GITHUB_TOKEN` for the actions in this job.
19+
permissions:
20+
contents: read
21+
packages: write
22+
steps:
23+
- name: Checkout repository
24+
uses: actions/checkout@v3
25+
# 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.
26+
- name: Log in to the Container registry
27+
uses: docker/login-action@v2
28+
with:
29+
registry: ${{ env.REGISTRY }}
30+
username: ${{ github.actor }}
31+
password: ${{ secrets.GITHUB_TOKEN }}
32+
33+
# 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.
34+
# 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.
35+
# It uses the `tags` and `labels` parameters to tag and label the image with the output from the "meta" step.
36+
- name: Build and push Docker image
37+
uses: docker/build-push-action@v4
38+
with:
39+
context: .
40+
push: true
41+
tags: torch_tensorrt:main
42+
file: docker/Dockerfile
43+
build-args: |
44+
TENSORRT_VERSION="8.6"
45+
CUDNN_VERSION="8.8"

0 commit comments

Comments
 (0)