Skip to content

Commit

Permalink
ci(crowd): add CI workflow for Docker image build
Browse files Browse the repository at this point in the history
Add GitHub Actions CI workflow to build and push Docker
image of Crowd to Docker Hub. Triggered on changes
to the Dockerfile in the main branch.
  • Loading branch information
trants committed Oct 27, 2024
1 parent b4a53c9 commit fada7f4
Showing 1 changed file with 36 additions and 0 deletions.
36 changes: 36 additions & 0 deletions .github/workflows/docker-publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
name: Build and Push Docker Image to Docker Hub

on:
push:
branches:
- main
paths:
- Dockerfile

jobs:
build:
runs-on: ubuntu-latest

steps:
# Step 1: Check out the repository containing the code
- name: Checkout repository
uses: actions/checkout@v2

# Step 2: Log in to Docker Hub using the credentials stored in GitHub Secrets
- name: Log in to Docker Hub
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKER_HUB_USERNAME }}
password: ${{ secrets.DOCKER_HUB_ACCESS_TOKEN }}

# Step 3: Build the Docker image using the Dockerfile in the repository
- name: Build Docker image
run: |
docker build -t ${{ secrets.DOCKER_HUB_USERNAME }}/crowd:${{ github.sha }} .
docker tag ${{ secrets.DOCKER_HUB_USERNAME }}/crowd:${{ github.sha }} ${{ secrets.DOCKER_HUB_USERNAME }}/crowd:6.1.1
# Step 4: Push the Docker image to Docker Hub
- name: Push Docker image to Docker Hub
run: |
docker buildx create --use
docker buildx build --platform linux/amd64,linux/arm64 -t ${{ secrets.DOCKER_HUB_USERNAME }}/crowd:6.1.1 --push .

0 comments on commit fada7f4

Please sign in to comment.