-
Notifications
You must be signed in to change notification settings - Fork 0
39 lines (35 loc) · 1.13 KB
/
build.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
name: Build docker image and upload to Docker Hub
on:
push:
branches:
- main
jobs:
deploy:
name: Build docker image and upload to Docker Hub
runs-on: ubuntu-latest
# These permissions are needed to interact with GitHub's OIDC Token endpoint.
permissions:
id-token: write
contents: read
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup buildx
uses: docker/setup-buildx-action@v3
- name: Set sha_short
id: vars_sha_short
run: echo "sha_short=$(git rev-parse --short HEAD)" >> $GITHUB_OUTPUT
- name: Log in to Docker Hub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
- name: Build, tag, and push docker image to Amazon ECR
id: push
uses: docker/build-push-action@v5
with:
cache-from: type=gha
cache-to: type=gha,mode=max
push: true
context: .
tags: birdhackor/centos7-py311:latest,birdhackor/centos7-py311:sha-${{ steps.vars_sha_short.outputs.sha_short }}