File tree Expand file tree Collapse file tree 2 files changed +45
-0
lines changed
Expand file tree Collapse file tree 2 files changed +45
-0
lines changed Original file line number Diff line number Diff line change 1+ # Name of the workflow
2+ name : Build and Push AWS-CLI Image to GHCR
3+
4+ # Controls when the action will run.
5+ on :
6+ push :
7+ branches : [ "main" ]
8+
9+ # Grant the GITHUB_TOKEN permissions to write to the container registry
10+ permissions :
11+ contents : read
12+ packages : write
13+
14+ jobs :
15+ build-and-push :
16+ runs-on : ubuntu-latest
17+ steps :
18+ # 1. Checks-out your repository
19+ - name : Checkout code
20+ uses : actions/checkout@v4
21+
22+ # 2. Logs in to the GitHub Container Registry (GHCR)
23+ # Uses the automatically generated GITHUB_TOKEN for authentication
24+ - name : Log in to GHCR
25+ uses : docker/login-action@v3
26+ with :
27+ registry : ghcr.io
28+ username : ${{ github.actor }}
29+ password : ${{ secrets.GITHUB_TOKEN }}
30+
31+ # 3. Builds and pushes the Docker image to GHCR
32+ # The image name is dynamically set to ghcr.io/OWNER/REPO_NAME
33+ - name : Build and push Docker image
34+ uses : docker/build-push-action@v5
35+ with :
36+ context : .
37+ push : true
38+ tags : ghcr.io/${{ github.repository }}:latest
Original file line number Diff line number Diff line change 1+ FROM docker:latest
2+
3+ RUN apk update \
4+ && apk add --no-cache \
5+ aws-cli \
6+ openssh-client \
7+ && rm -rf /var/cache/apk/*
You can’t perform that action at this time.
0 commit comments