GitHub Action
Build and Push Docker Image to Docker Hub
v3.0.2
Latest version
- this will have
config
andexpress
package under its docker image.
name: Build and Push Docker Image to Docker Hub
on: push
jobs:
push_to_registry:
name: push docker image to hub
runs-on: ubuntu-latest
steps:
- name: check repository
uses: actions/checkout@v4
- name: login to docker registry
uses: docker/login-action@v3
with:
username: ${{secrets.DOCKERHUB_USERNAME}}
password: ${{secrets.DOCKERHUB_TOKEN}}
- name: build and push docker image to registry
uses: docker/build-push-action@v5
with:
context: DockerFileFolder/
push: true
tags: black1512/demo1:latest
- you need to specify your
DOCKERHUB_USERNAME
andDOCKERHUB_TOKEN
inside your repos secrets.
- This will update
https://hub.docker.com/r/black1512/demo1
docker registry.
# pull this image by
docker pull black1512/demo1:latest
- need to configure
DOCKERHUB_USERNAME
andDOCKERHUB_TOKEN
secrets for your repo.