Skip to content

Commit b50fe85

Browse files
committed
feat: add step to workflow to publish docker image to docker registry
1 parent f78de4a commit b50fe85

File tree

2 files changed

+30
-1
lines changed

2 files changed

+30
-1
lines changed

.github/workflows/release.yaml

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,4 +35,22 @@ jobs:
3535
REPO_OWNER: "Local-Connectivity-Lab"
3636
REPO_NAME: "ccn-coverage-docker"
3737
TARGET_ARTIFACT_NAME: "ccn-coverage-vis"
38-
run: npx semantic-release
38+
run: npx semantic-release
39+
40+
- name: Get version
41+
id: get_version
42+
run: |
43+
VERSION=$(node -p "require('./package.json').version")
44+
echo "VERSION=$VERSION" >> $GITHUB_OUTPUT
45+
echo "Released version: $VERSION"
46+
47+
- name: Login to Docker Registry
48+
uses: docker/login-action@v3
49+
with:
50+
registry: icr.infra.seattlecommunitynetwork.org
51+
username: ${{ secrets.REGISTRY_USERNAME }}
52+
password: ${{ secrets.REGISTRY_PASSWORD }}
53+
54+
- name: Build and publish Docker image
55+
run: |
56+
make publish VERSION=${{ steps.get_version.outputs.VERSION }}

Makefile

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,16 @@ build-%: validate-semver-%
3737
@echo "Create docker container for $(VIS_DOCKER_IMAGE_NAME) with version $*"
3838
docker build -t $(VIS_DOCKER_IMAGE_NAME):$* -f vis.dockerfile .
3939

40+
# Publish to Docker registry (e.g., make publish VERSION=1.2.3)
41+
.PHONY: publish
42+
publish: validate-semver-$(VERSION)
43+
@echo "Building and publishing $(VIS_DOCKER_IMAGE_NAME):$(VERSION)"
44+
docker build -t $(VIS_DOCKER_IMAGE_NAME):$(VERSION) -f vis.dockerfile .
45+
docker tag $(VIS_DOCKER_IMAGE_NAME):$(VERSION) icr.infra.seattlecommunitynetwork.org/$(VIS_DOCKER_IMAGE_NAME):$(VERSION)
46+
docker tag $(VIS_DOCKER_IMAGE_NAME):$(VERSION) icr.infra.seattlecommunitynetwork.org/$(VIS_DOCKER_IMAGE_NAME):latest
47+
docker push icr.infra.seattlecommunitynetwork.org/$(VIS_DOCKER_IMAGE_NAME):$(VERSION)
48+
docker push icr.infra.seattlecommunitynetwork.org/$(VIS_DOCKER_IMAGE_NAME):latest
49+
@echo "Successfully published $(VIS_DOCKER_IMAGE_NAME):$(VERSION) to registry"
4050

4151
# The target for development
4252
.PHONY: dev
@@ -45,4 +55,5 @@ dev:
4555
-v $(CURRENT_DIR):/app \
4656
-w /app \
4757
-p $(EXPOSED_PORT):$(EXPOSED_PORT) \
58+
--network ccn-coverage-api_coverage-app-network \
4859
$(DOCKER_IMAGE) /bin/bash

0 commit comments

Comments
 (0)