Makefile

make β€” ΡƒΡ‚ΠΈΠ»ΠΈΡ‚Π°, Π°Π²Ρ‚ΠΎΠΌΠ°Ρ‚ΠΈΠ·ΠΈΡ€ΡƒΡŽΡ‰Π°Ρ процСсс прСобразования Ρ„Π°ΠΉΠ»ΠΎΠ² ΠΈΠ· ΠΎΠ΄Π½ΠΎΠΉ Ρ„ΠΎΡ€ΠΌΡ‹ Π² Π΄Ρ€ΡƒΠ³ΡƒΡŽ. Π§Π°Ρ‰Π΅ всСго это компиляция исходного ΠΊΠΎΠ΄Π° Π² ΠΎΠ±ΡŠΠ΅ΠΊΡ‚Π½Ρ‹Π΅ Ρ„Π°ΠΉΠ»Ρ‹ ΠΈ ΠΏΠΎΡΠ»Π΅Π΄ΡƒΡŽΡ‰Π°Ρ ΠΊΠΎΠΌΠΏΠΎΠ½ΠΎΠ²ΠΊΠ° Π² исполняСмыС Ρ„Π°ΠΉΠ»Ρ‹ ΠΈΠ»ΠΈ Π±ΠΈΠ±Π»ΠΈΠΎΡ‚Π΅ΠΊΠΈ.

ΠšΠΎΠ½Ρ„ΠΈΠ³ Ρ„Π°ΠΉΠ» ΠΊ этой ΡƒΡ‚ΠΈΠ»ΠΈΡ‚Π΅ β€” Makefile.

ΠŸΡ€ΠΈΠΌΠ΅Ρ€:

CONTAINER_NAME ?= mycontainer
RELEASE_VERSION ?= 0.0.0
DISTRIB_BUILD_NUMBER ?= 0
DISTRIB_PATH ?= mydistrib.zip

IMAGE_NAME = $(CONTAINER_NAME):$(RELEASE_VERSION)-$(DISTRIB_BUILD_NUMBER)

all: clean check build

build: build-image:
    docker build -t $(IMAGE_NAME) ./
    
build: build-image
    docker run -w /build --name $(CONTAINER_NAME) $(IMAGE_NAME) /bin/bash -c "./build.sh $(RELEASE_VERSION) $(DISTRIB_BUILD_NUMBER)"
    docker container cp $(CONTAINER_NAME):/some/path/x86_64/cont.rpm
    
check: build-image
    docker run --rm -w /build --name $(CONTAINER_NAME) $(IMAGE_NAME) /bin/bash -c "./check.sh"
    
clean:
    rm -f $(DISTRIB_PATH) /other/path
    docker container rm -f $(CONTAINER_NAME) 2>/dev/null || echo 'Container not found'
    docker image rm -f $(IMAGE_NAME) 2>/dev/null || echo 'Image not found'
    
distrib:
    cp -r build/liquibase ./
    zip -r -Z store $(DISTRIB_PATH) liquibase
    
.PHONY: all build-image build clean distrib

И соотв запуск:

$ make build

Last updated