Skip to content

Commit b8040d1

Browse files
authored
Add Docker release workflow for automated image builds (#105)
### TL;DR Added a GitHub Actions workflow for Docker image release ### What changed? - Created a new GitHub Actions workflow file `.github/workflows/docker-release.yml` for automated Docker image building and pushing on release events. - The workflow uses Docker Buildx, logs into Docker Hub, extracts metadata, and builds/pushes the image with appropriate tags and labels. ### How to test? 1. Create a new release or manually trigger the workflow. 2. Verify that the GitHub Action runs successfully. 3. Check Docker Hub to ensure the new image is pushed with the correct tags. ### Why make this change? This change automates the Docker image release process, ensuring consistent and reliable deployments. It streamlines the release workflow, reducing manual intervention and potential errors during the release process.
2 parents 0f4dd40 + e169a58 commit b8040d1

File tree

3 files changed

+41
-2
lines changed

3 files changed

+41
-2
lines changed

.dockerignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
.env
22
.mockery.yaml
33

4-
configs/secrets*
4+
configs/secrets*
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
name: Docker Release
2+
3+
on:
4+
release:
5+
types: [published]
6+
workflow_dispatch:
7+
8+
env:
9+
DOCKER_IMAGE: thirdweb/indexer
10+
11+
jobs:
12+
build-and-push:
13+
runs-on: ubuntu-latest
14+
steps:
15+
- name: Checkout code
16+
uses: actions/checkout@v4
17+
18+
- name: Set up Docker Buildx
19+
uses: docker/setup-buildx-action@v3
20+
21+
- name: Login to Docker Hub
22+
uses: docker/login-action@v3
23+
with:
24+
username: ${{ secrets.DOCKERHUB_USERNAME }}
25+
password: ${{ secrets.DOCKERHUB_TOKEN }}
26+
27+
- name: Extract metadata (tags, labels) for Docker
28+
id: meta
29+
uses: docker/metadata-action@v5
30+
with:
31+
images: ${{ env.DOCKER_IMAGE }}
32+
33+
- name: Build and push Docker image
34+
uses: docker/build-push-action@v5
35+
with:
36+
context: .
37+
push: true
38+
tags: ${{ steps.meta.outputs.tags }}
39+
labels: ${{ steps.meta.outputs.labels }}

Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,4 +21,4 @@ EXPOSE 8080
2121

2222
ENTRYPOINT ["/bin/app"]
2323

24-
CMD []
24+
CMD []

0 commit comments

Comments
 (0)