Skip to content

Commit

Permalink
Changed makefile to be tag-aware
Browse files Browse the repository at this point in the history
  • Loading branch information
NadavTasher committed Jan 19, 2024
1 parent d037183 commit 81bc2af
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1 +1 @@
image/Dockerfile
image/Dockerfile-*
8 changes: 4 additions & 4 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -28,11 +28,11 @@ prerequisites:
format: $(wildcard $(BACKEND_PATH)/*.py) | prerequisites
$(PYTHON) -m yapf -i $^ --style "{based_on_style: google, column_limit: 400, indent_width: 4}"

image: $(IMAGE_PATH)/Dockerfile | format $(IMAGE_SOURCES)
image: $(IMAGE_PATH)/Dockerfile-$(IMAGE_TAG) | format $(IMAGE_SOURCES)
$(DOCKER) build $(IMAGE_PATH) -f $^ -t $(IMAGE_NAME)/$(IMAGE_TAG) -t $(IMAGE_NAME)/$(IMAGE_DATE_TAG) -t $(IMAGE_NAME)/$(IMAGE_LATEST_TAG)

clean:
$(RM) $(IMAGE_PATH)/Dockerfile
$(RM) $(IMAGE_PATH)/*.Dockerfile

test: image
$(DOCKER) run --rm -p 80:80 -p 443:443 $(IMAGE_NAME)/$(IMAGE_TAG)
Expand All @@ -45,7 +45,7 @@ test-bundle: bundle

bundle: image $(BUNDLE_BACKEND_PATH)/app.py $(BUNDLE_BACKEND_PATH)/worker.py $(BUNDLE_FRONTEND_PATH)/index.html $(BUNDLE_FRONTEND_PATH)/application/application.css $(BUNDLE_FRONTEND_PATH)/application/application.js

buildx: $(IMAGE_PATH)/Dockerfile | format $(IMAGE_SOURCES)
buildx: $(IMAGE_PATH)/Dockerfile-$(IMAGE_TAG) | format $(IMAGE_SOURCES)
$(DOCKER) buildx create --use
$(DOCKER) buildx build $(IMAGE_PATH) --push --platform linux/386,linux/amd64,linux/arm/v5,linux/arm/v7,linux/arm64/v8 -f $^ -t $(IMAGE_NAME)/$(IMAGE_DATE_TAG) -t $(IMAGE_NAME)/$(IMAGE_LATEST_TAG)

Expand All @@ -61,6 +61,6 @@ $(BUNDLE_FRONTEND_PATH)/application/application.%: $(FRONTEND_PATH)/application/
$(MKDIR) -p $(@D)
$(COPY) $^ $@

$(IMAGE_PATH)/Dockerfile: $(IMAGE_PATH)/Dockerfile.template | prerequisites
$(IMAGE_PATH)/Dockerfile-$(IMAGE_TAG): $(IMAGE_PATH)/Dockerfile.template | prerequisites
$(MKDIR) -p $(@D)
$(PYTHON) -m jinja2cli.cli $^ -DBASE_IMAGE=$(BASE_IMAGE) > $@

0 comments on commit 81bc2af

Please sign in to comment.