This GitHub Action automates the process of building and pushing Docker images with caching, utilizing the dynamic generation of Docker image names based on repository, branch, and commit hash.
To use this action in your workflow, add the following step:
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Build and Push Docker Image
uses: Alve-Development/alve-build-apps@v1.0.0
with:
env-file: ${{ secrets.ENV_FILE }}
docker-username: ${{ secrets.DOCKER_HUB_USERNAME }}
docker-password: ${{ secrets.DOCKER_HUB_ACCESS_TOKEN }}docker-username: Your Docker Hub username. (Required)docker-password: Your Docker Hub password or access token. (Required)env-file: Env file contents to be copied.envfile. (Optional)
docker-image-name: The full name of the Docker image that was built and pushed.
Here's a full workflow example:
name: Deploy
on:
push:
branches:
- main
jobs:
build-and-push:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Build and Push Docker Image
uses: Alve-Development/alve-build-apps@v1.0.0
with:
env-file: ${{ secrets.ENV_FILE }}
docker-username: ${{ secrets.DOCKER_HUB_USERNAME }}
docker-password: ${{ secrets.DOCKER_HUB_ACCESS_TOKEN }}Contributions are welcome! Please feel free to submit a pull request.