Skip to content

Merge pull request #307 from rohaizanr:update-public-web #20

Merge pull request #307 from rohaizanr:update-public-web

Merge pull request #307 from rohaizanr:update-public-web #20

name: Publish Public Web to Docker Hub
on:
push:
branches:
- main
paths:
- "public-web/**"
jobs:
build-public-web:
runs-on: ubuntu-latest
steps:
- name: Check out the code
uses: actions/checkout@v4
- name: Verify Docker Hub credentials
run: |
if [[ -z "${{ secrets.DOCKER_USERNAME }}" || -z "${{ secrets.DOCKER_PASSWORD }}" ]]; then
echo "Error: Missing Docker Hub credentials";
exit 1;
fi
- name: Log in to Docker Hub
run: |
echo ${{ secrets.DOCKER_PASSWORD }} | docker login -u "${{ secrets.DOCKER_USERNAME }}" --password-stdin
- name: Build and publish to Docker Hub
run: |
VERSION=$(git rev-parse HEAD) # Use short commit hash for versioning
IMAGE_NAME=dev4w4n/emasjid-public-web:${VERSION}
docker build -t emasjid-public-web ./public-web
docker tag emasjid-public-web $IMAGE_NAME
docker push $IMAGE_NAME