Skip to content

Commit

Permalink
Added workflows for ubi image
Browse files Browse the repository at this point in the history
Signed-off-by: Maia Iyer <[email protected]>
  • Loading branch information
maia-iyer committed Sep 25, 2023
1 parent 0ee836e commit fde321c
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 70 deletions.
16 changes: 7 additions & 9 deletions .github/workflows/master-build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -59,17 +59,15 @@ jobs:
run: echo "REPO=ghcr.io/${{ github.repository_owner }}" >> $GITHUB_ENV

# build and push images tagged with GITHUB_SHA, version, and latest
- name: Build and push tornjak backend image
run: make release-tornjak-backend
- name: Build and push tornjak images
run: make release-images

- name: Build and push tornjak frontend image
run: make release-tornjak-frontend
# build and push UBI images
- name: Add ubi prefix
run: echo "IMAGE_TAG_PREFIX=ubi-"

- name: Build and push tornjak image (frontend+backend)
run: make release-tornjak

- name: Build and push tornjak manager image
run: make release-tornjak-manager
- name: Build and push UBI images
run: make release-images

- name: Print job result
run: |
Expand Down
35 changes: 0 additions & 35 deletions Dockerfile.tornjak-container

This file was deleted.

46 changes: 20 additions & 26 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,14 @@ CONTAINER_TORNJAK_TAG ?= $(REPO)/tornjak
CONTAINER_BACKEND_TAG ?= $(REPO)/tornjak-backend
CONTAINER_FRONTEND_TAG ?= $(REPO)/tornjak-frontend
CONTAINER_MANAGER_TAG ?= $(REPO)/tornjak-manager
IMAGE_TAG_PREFIX ?=

## dockerfile for each container default to alpine base image
DOCKERFILE_BACKEND ?= Dockerfile.backend-container
DOCKERFILE_FRONTEND ?= Dockerfile.frontend-container

BINARIES=tornjak-backend tornjak-manager
IMAGES=$(BINARIES) tornjak-frontend tornjak
IMAGES=$(BINARIES) tornjak-frontend

GO_VERSION ?= 1.20

Expand Down Expand Up @@ -75,23 +80,18 @@ images: $(addprefix image-,$(IMAGES)) ## Build all images

.PHONY: image-tornjak-backend
image-tornjak-backend: bin/tornjak-backend ## Build image for bin/tornjak-backend
docker build --no-cache -f Dockerfile.backend-container --build-arg version=$(VERSION) \
--build-arg github_sha=$(GITHUB_SHA) -t $(CONTAINER_BACKEND_TAG):$(VERSION) .
docker build --no-cache -f $(DOCKERFILE_BACKEND) --build-arg version=$(VERSION) \
--build-arg github_sha=$(GITHUB_SHA) -t $(CONTAINER_BACKEND_TAG):$(IMAGE_TAG_PREFIX)$(VERSION) .

.PHONY: image-tornjak-manager
image-tornjak-manager: bin/tornjak-manager ## Build image for bin/tornjak-manager
docker build --no-cache -f Dockerfile.tornjak-manager --build-arg version=$(VERSION) \
--build-arg github_sha=$(GITHUB_SHA) -t $(CONTAINER_MANAGER_TAG):$(VERSION) .
--build-arg github_sha=$(GITHUB_SHA) -t $(CONTAINER_MANAGER_TAG):$(IMAGE_TAG_PREFIX)$(VERSION) .

.PHONY: image-tornjak-frontend
image-tornjak-frontend: ## Build image for tornjak-frontend
docker build --no-cache -f Dockerfile.frontend-container --build-arg version=$(VERSION) \
--build-arg github_sha=$(GITHUB_SHA) -t $(CONTAINER_FRONTEND_TAG):$(VERSION) .

.PHONY: image-tornjak
image-tornjak: bin/tornjak-backend ## Build image for bin/tornjak-backend and tornjak-frontend bundled in single image
docker build --no-cache -f Dockerfile.tornjak-container --build-arg version=$(VERSION) \
--build-arg github_sha=$(GITHUB_SHA) -t $(CONTAINER_TORNJAK_TAG):$(VERSION) .
docker build --no-cache -f $(DOCKERFILE_FRONTEND) --build-arg version=$(VERSION) \
--build-arg github_sha=$(GITHUB_SHA) -t $(CONTAINER_FRONTEND_TAG):$(IMAGE_TAG_PREFIX)$(VERSION) .

##@ Run:

Expand All @@ -107,24 +107,18 @@ release-images: $(addprefix release-,$(IMAGES)) ## Release all images

.PHONY: release-tornjak-backend
release-tornjak-backend: image-tornjak-backend ## Release tornjak-backend image
docker push $(CONTAINER_BACKEND_TAG):$(VERSION)
docker tag $(CONTAINER_BACKEND_TAG):$(VERSION) $(CONTAINER_BACKEND_TAG):$(GITHUB_SHA)
docker push $(CONTAINER_BACKEND_TAG):$(GITHUB_SHA)
docker push $(CONTAINER_BACKEND_TAG):$(IMAGE_TAG_PREFIX)$(VERSION)
docker tag $(CONTAINER_BACKEND_TAG):$(IMAGE_TAG_PREFIX)$(VERSION) $(CONTAINER_BACKEND_TAG):$(IMAGE_TAG_PREFIX)$(GITHUB_SHA)
docker push $(CONTAINER_BACKEND_TAG):$(IMAGE_TAG_PREFIX)$(GITHUB_SHA)

.PHONY: release-tornjak-manager
release-tornjak-manager: image-tornjak-manager ## Release tornjak-manager image
docker push $(CONTAINER_MANAGER_TAG):$(VERSION)
docker tag $(CONTAINER_MANAGER_TAG):$(VERSION) $(CONTAINER_MANAGER_TAG):$(GITHUB_SHA)
docker push $(CONTAINER_MANAGER_TAG):$(GITHUB_SHA)
docker push $(CONTAINER_MANAGER_TAG):$(IMAGE_TAG_PREFIX)$(VERSION)
docker tag $(CONTAINER_MANAGER_TAG):$(IMAGE_TAG_PREFIX)$(VERSION) $(CONTAINER_MANAGER_TAG):$(IMAGE_TAG_PREFIX)$(GITHUB_SHA)
docker push $(CONTAINER_MANAGER_TAG):$(IMAGE_TAG_PREFIX)$(GITHUB_SHA)

.PHONY: release-tornjak-frontend
release-tornjak-frontend: image-tornjak-frontend ## Release tornjak-frontend image
docker push $(CONTAINER_FRONTEND_TAG):$(VERSION)
docker tag $(CONTAINER_FRONTEND_TAG):$(VERSION) $(CONTAINER_FRONTEND_TAG):$(GITHUB_SHA)
docker push $(CONTAINER_FRONTEND_TAG):$(GITHUB_SHA)

.PHONY: release-tornjak
release-tornjak: image-tornjak ## Release tornjak image (bundling frontend and backend)
docker push $(CONTAINER_TORNJAK_TAG):$(VERSION)
docker tag $(CONTAINER_TORNJAK_TAG):$(VERSION) $(CONTAINER_TORNJAK_TAG):$(GITHUB_SHA)
docker push $(CONTAINER_TORNJAK_TAG):$(GITHUB_SHA)
docker push $(CONTAINER_FRONTEND_TAG):$(IMAGE_TAG_PREFIX)$(VERSION)
docker tag $(CONTAINER_FRONTEND_TAG):$(IMAGE_TAG_PREFIX)$(VERSION) $(CONTAINER_FRONTEND_TAG):$(IMAGE_TAG_PREFIX)$(GITHUB_SHA)
docker push $(CONTAINER_FRONTEND_TAG):$(IMAGE_TAG_PREFIX)$(GITHUB_SHA)

0 comments on commit fde321c

Please sign in to comment.