Skip to content

Commit 9bff11d

Browse files
authored
Merge pull request #401 from MerginMaps/push_to_dockerhub
Publish docker images to dockerhub
2 parents 94b102a + 7281567 commit 9bff11d

File tree

1 file changed

+40
-0
lines changed

1 file changed

+40
-0
lines changed

.github/workflows/publish.yaml

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
name: Build and publish public images
2+
on:
3+
workflow_dispatch:
4+
5+
env:
6+
REGISTRY: docker.io
7+
REPOSITORY: lutraconsulting/merginmaps
8+
9+
jobs:
10+
build:
11+
runs-on: ubuntu-latest
12+
steps:
13+
- name: Checkout repository
14+
uses: actions/checkout@v4
15+
- name: Log into registry ${{ env.REGISTRY }}
16+
uses: docker/login-action@v3
17+
with:
18+
registry: ${{ env.REGISTRY }}
19+
username: ${{ secrets.DOCKERHUB_LOGIN }}
20+
password: ${{ secrets.DOCKERHUB_TOKEN }}
21+
- name: Build, tag, and push CE images to Dockerhub
22+
env:
23+
BUILD_HASH: ${{ github.sha }}
24+
IMAGE_TAG: ${{ github.ref_name }}
25+
run: |
26+
if [[ $GITHUB_REF_TYPE != "tag" ]]; then
27+
echo "Not a tag, exiting"
28+
exit 1
29+
fi
30+
echo "IMAGE_TAG=$IMAGE_TAG" >> "$GITHUB_ENV"
31+
cd server
32+
docker build -f Dockerfile . --build-arg BUILD_HASH=${BUILD_HASH} -t $REGISTRY/$REPOSITORY-backend:$IMAGE_TAG;
33+
cd ../web-app
34+
docker build -f Dockerfile . -t $REGISTRY/$REPOSITORY-frontend:$IMAGE_TAG
35+
docker push $REGISTRY/$REPOSITORY-backend:$IMAGE_TAG
36+
docker push $REGISTRY/$REPOSITORY-frontend:$IMAGE_TAG
37+
- name: Build info
38+
run: |
39+
echo "IMAGE_TAG=$IMAGE_TAG"
40+
echo "GITHUB_SHA=$GITHUB_SHA"

0 commit comments

Comments
 (0)