Loongson-Cloud-Community / dockerfiles

14 stars 14 forks source link

添加镜像的测试用例 #225

Open wojiushixiaobai opened 3 months ago

wojiushixiaobai commented 3 months ago

目前已经简单的实现了部分镜像的自动化构建,需要一个测试用例来验证构建的镜像是否可以正常使用。

# library/python/3.12/Makefile
# This file is generated by the template.

REGISTRY?=cr.loongnix.cn
ORGANIZATION?=library
REPOSITORY?=python
TAG?=3.12
VERSION?=3.12.3

IMAGE=$(REGISTRY)/$(ORGANIZATION)/$(REPOSITORY):$(TAG)
FULL_IMAGE=$(REGISTRY)/$(ORGANIZATION)/$(REPOSITORY):$(VERSION)

default: image

image:
    docker build \
        --build-arg http_proxy=$(http_proxy) \
        --build-arg https_proxy=$(https_proxy) \
        -t $(IMAGE) \
        -t $(IMAGE)-slim-buster \
        -t $(FULL_IMAGE) \
        -t $(FULL_IMAGE)-slim-buster \
        ./debian

test:
    docker run --rm -i $(IMAGE) python --version

push:
    docker push $(IMAGE)
    docker push $(IMAGE)-slim-buster
    docker push $(FULL_IMAGE)
    docker push $(FULL_IMAGE)-slim-buster
make test

比如最简单的 command --help 或者 command --version 等,简单测试应用二进制文件执行没有异常。