-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
ci(crowd): add CI workflow for Docker image build
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
Showing
1 changed file
with
36 additions
and
0 deletions.
There are no files selected for viewing
This file contains 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
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 . |