Skip to content

Commit 09b5aa5

Browse files
davidbrotapaologallinaharbur
authored andcommitted
fix(makefile) pass the environment variable VERSION to the container
1 parent 6f56242 commit 09b5aa5

File tree

2 files changed

+9
-6
lines changed

2 files changed

+9
-6
lines changed

Makefile

+5-2
Original file line numberDiff line numberDiff line change
@@ -26,15 +26,18 @@ build-local: clean compile test
2626
build: build-container-image delete-container test-container delete-container
2727

2828
build-container-image:
29+
@echo "=== $(PROJECT_NAME) === [ $@ ]: Building the container image"
2930
@docker build --no-cache -t $(CONTAINER_IMAGE) -f Dockerfile.test .
3031

3132
test-container:
33+
@echo "=== $(PROJECT_NAME) === [ $@ ]: Testing the integration"
3234
@echo "make test" | docker run --name $(CONTAINER) -i $(CONTAINER_IMAGE)
3335
@docker cp $(CONTAINER):$(CONTAINER_PATH)/coverage.xml .
3436

3537
compile-container: bin
36-
@echo "make compile" | docker run --name $(CONTAINER) -i $(CONTAINER_IMAGE)
37-
@docker cp $(CONTAINER):$(CONTAINER_PATH)/bin/$(BINARY_NAME) $(BINS_DIR)
38+
@echo "=== $(PROJECT_NAME) === [ $@ ]: Creating the binaries"
39+
@echo "make create-bins" | docker run --name $(CONTAINER) -i -e VERSION $(CONTAINER_IMAGE)
40+
@docker cp $(CONTAINER):$(CONTAINER_PATH)/$(TARGET)/bin/linux_amd64/$(BINARY_NAME) $(BINS_DIR)
3841

3942
delete-container:
4043
-docker rm -f $(CONTAINER) 2>/dev/null

package.mk

+4-4
Original file line numberDiff line numberDiff line change
@@ -20,12 +20,12 @@ FPM_DEB_OPTIONS = -t deb -p $(PACKAGES_DIR)/deb/
2020
FPM_RPM_OPTIONS = -t rpm -p $(PACKAGES_DIR)/rpm/ --epoch 0 --rpm-summary $(SUMMARY)
2121

2222

23-
package-local: clean create-bins-local prep-pkg-env $(PACKAGE_TYPES)
24-
package: clean create-bins prep-pkg-env $(PACKAGE_TYPES)
23+
package-local: clean create-bins prep-pkg-env $(PACKAGE_TYPES)
24+
package: clean create-bins-container prep-pkg-env $(PACKAGE_TYPES)
2525

26-
create-bins: build-container-image delete-container compile-container delete-container
26+
create-bins-container: build-container-image delete-container compile-container delete-container
2727

28-
create-bins-local: deps
28+
create-bins: deps
2929
echo "=== Main === [ create-bins ]: creating binary ..."
3030
GOOS=linux go build -v -ldflags '-X main.buildVersion=$(VERSION)' -o $(BINS_DIR)/$(BINARY_NAME) $(GO_FILES) || exit 1
3131
@echo ""

0 commit comments

Comments
 (0)