sudo issue #9
This file contains 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
name: Docker Build and Push Docker images | |
on: | |
push: | |
branches: [main] | |
# tags: | |
# - 'v*.*.*' | |
env: | |
DOCKER_USERNAME: ${{ secrets.DOCKER_USERNAME }} | |
DOCKER_PASSWORD: ${{ secrets.DOCKER_PASSWORD }} | |
IMAGE_NAME: ${{ secrets.DOCKER_USERNAME }}/devops-linux-tools | |
DOCKERFILE_PATH: ./Dockerfile | |
jobs: | |
build-and-push: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4.1.1 | |
- name: Set Release Version | |
run: | | |
echo "BUILD_VERSION=$(date --rfc-3339=date)" >> ${GITHUB_ENV} | |
- name: Checkout code | |
uses: actions/checkout@v4.1.1 | |
- name: Login to Docker Hub | |
uses: docker/login-action@v3.1.0 | |
with: | |
username: ${{ env.DOCKER_USERNAME }} | |
password: ${{ env.DOCKER_PASSWORD }} | |
- name: Extract metadata for the Docker image | |
id: meta | |
uses: docker/metadata-action@v5.5.1 | |
with: | |
images: ${{ env.DOCKER_USERNAME }}/${{ env.IMAGE_NAME }} | |
- name: Build and Push Docker image | |
uses: docker/build-push-action@v5.3.0 | |
with: | |
context: . | |
push: true | |
tags: ${{ env.IMAGE_NAME }}:${{ env.BUILD_VERSION }} | |
dockerfile: ${{ env.DOCKERFILE_PATH }} |