Docker Nginx Push CI #2
This file contains hidden or 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 Nginx Push CI | |
on: | |
workflow_dispatch: | |
inputs: | |
docker_username: | |
description: "Docker Hub Username" | |
required: true | |
default: "" | |
docker_password: | |
description: "Docker Hub Password" | |
required: true | |
default: "" | |
type: password | |
jobs: | |
build-and-push: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Log in to Docker Hub | |
run: echo "${{ github.event.inputs.docker_password }}" | docker login -u "${{ github.event.inputs.docker_username }}" --password-stdin | |
- name: Build the Docker image | |
run: | | |
cd nginx-image/ | |
docker build . --file Dockerfile --tag my-image-name:$(date +%s) | |
docker tag my-image-name:$(date +%s) ${{ github.event.inputs.docker_username }}/my-image-name:latest | |
- name: Push the Docker image | |
run: docker push ${{ github.event.inputs.docker_username }}/my-image-name:latest |