feat: add make file

Signed-off-by: Xinwei Xiong(cubxxw-openim) <3293172751nss@gmail.com>
This commit is contained in:
Xinwei Xiong(cubxxw-openim)
2023-07-05 22:12:48 +08:00
parent ae2369c3a9
commit d30131166d
9 changed files with 230 additions and 44 deletions
+9 -9
View File
@@ -203,9 +203,9 @@ function openim::build::prepare_docker_machine() {
openim::log::status "Creating a machine to build OPENIM"
docker-machine create --driver "${DOCKER_MACHINE_DRIVER}" \
--virtualbox-memory "${virtualbox_memory_mb}" \
--engine-env HTTP_PROXY="${IAMRNETES_HTTP_PROXY:-}" \
--engine-env HTTPS_PROXY="${IAMRNETES_HTTPS_PROXY:-}" \
--engine-env NO_PROXY="${IAMRNETES_NO_PROXY:-127.0.0.1}" \
--engine-env HTTP_PROXY="${OPENIMRNETES_HTTP_PROXY:-}" \
--engine-env HTTPS_PROXY="${OPENIMRNETES_HTTPS_PROXY:-}" \
--engine-env NO_PROXY="${OPENIMRNETES_NO_PROXY:-127.0.0.1}" \
"${DOCKER_MACHINE_NAME}" > /dev/null || {
openim::log::error "Something went wrong creating a machine."
openim::log::error "Try the following: "
@@ -250,14 +250,14 @@ function openim::build::update_dockerfile() {
}
function openim::build::set_proxy() {
if [[ -n "${IAMRNETES_HTTPS_PROXY:-}" ]]; then
echo "ENV https_proxy $IAMRNETES_HTTPS_PROXY" >> "${LOCAL_OUTPUT_BUILD_CONTEXT}/Dockerfile"
if [[ -n "${OPENIMRNETES_HTTPS_PROXY:-}" ]]; then
echo "ENV https_proxy $OPENIMRNETES_HTTPS_PROXY" >> "${LOCAL_OUTPUT_BUILD_CONTEXT}/Dockerfile"
fi
if [[ -n "${IAMRNETES_HTTP_PROXY:-}" ]]; then
echo "ENV http_proxy $IAMRNETES_HTTP_PROXY" >> "${LOCAL_OUTPUT_BUILD_CONTEXT}/Dockerfile"
if [[ -n "${OPENIMRNETES_HTTP_PROXY:-}" ]]; then
echo "ENV http_proxy $OPENIMRNETES_HTTP_PROXY" >> "${LOCAL_OUTPUT_BUILD_CONTEXT}/Dockerfile"
fi
if [[ -n "${IAMRNETES_NO_PROXY:-}" ]]; then
echo "ENV no_proxy $IAMRNETES_NO_PROXY" >> "${LOCAL_OUTPUT_BUILD_CONTEXT}/Dockerfile"
if [[ -n "${OPENIMRNETES_NO_PROXY:-}" ]]; then
echo "ENV no_proxy $OPENIMRNETES_NO_PROXY" >> "${LOCAL_OUTPUT_BUILD_CONTEXT}/Dockerfile"
fi
}
+4 -4
View File
@@ -24,7 +24,7 @@
# Tencent cos configuration
readonly BUCKET="openim-1306374445"
readonly REGION="ap-beijing"
readonly REGION="ap-guangzhou"
readonly COS_RELEASE_DIR="openim-release"
# default cos command tool coscli or coscmd
@@ -178,7 +178,7 @@ function openim::release::package_server_tarballs() {
# This fancy expression will expand to prepend a path
# (${LOCAL_OUTPUT_BINPATH}/${platform}/) to every item in the
# server_bins array.
cp "${server_bins[@]/#/${LOCAL_OUTPUT_BINPATH}/${platform}/}" \
cp "${server_bins[@]/bin/#/${LOCAL_OUTPUT_BINPATH}/${platform}/}" \
"${release_stage}/server/bin/"
openim::release::clean_cruft
@@ -218,7 +218,7 @@ function openim::release::package_client_tarballs() {
# This fancy expression will expand to prepend a path
# (${LOCAL_OUTPUT_BINPATH}/${platform}/) to every item in the
# client_bins array.
cp "${client_bins[@]/#/${LOCAL_OUTPUT_BINPATH}/${platform}/}" \
cp "${client_bins[@]/bin/#/${LOCAL_OUTPUT_BINPATH}/${platform}/}" \
"${release_stage}/client/bin/"
openim::release::clean_cruft
@@ -252,7 +252,7 @@ function openim::release::build_server_images() {
# This fancy expression will expand to prepend a path
# (${LOCAL_OUTPUT_BINPATH}/${platform}/) to every item in the
# OPENIM_SERVER_IMAGE_BINARIES array.
cp "${OPENIM_SERVER_IMAGE_BINARIES[@]/#/${LOCAL_OUTPUT_BINPATH}/${platform}/}" \
cp "${OPENIM_SERVER_IMAGE_BINARIES[@]/bin/#/${LOCAL_OUTPUT_BINPATH}/${platform}/}" \
"${release_stage}/server/bin/"
openim::release::create_docker_images_for_server "${release_stage}/server/bin" "${arch}"
+1
View File
@@ -199,6 +199,7 @@ openim::util::find-binary-for-platform() {
"${OPENIM_ROOT}/_output/${platform}/${lookfor}"
"${OPENIM_ROOT}/_output/local/bin/${platform}/${lookfor}"
"${OPENIM_ROOT}/_output/platforms/${platform}/${lookfor}"
"${OPENIM_ROOT}/_output/platforms/bin/${platform}/${lookfor}"
)
# List most recently-updated location.
+1 -1
View File
@@ -87,7 +87,7 @@ endif
# The OS must be linux when building docker images
# PLATFORMS ?= linux_amd64 linux_arm64
# The OS can be linux/windows/darwin when building binaries
PLATFORMS ?= linux_s390x linux_mips64 linux_mips64le darwin_amd64 windows_amd64 linux_amd64 linux_arm64
PLATFORMS ?= linux_s390x linux_mips64 linux_mips64le darwin_amd64 windows_amd64 linux_amd64 linux_arm64 linux_ppc64le
# only support linux
GOOS=linux
+7
View File
@@ -98,6 +98,13 @@ image.build.%: go.build.%
fi
@rm -rf $(TMP_DIR)/$(IMAGE)
## image.buildx.%: Build docker images with buildx
.PHONY: image.buildx.%
image.buildx.%:
$(eval IMAGE := $(word 1,$(subst ., ,$*)))
echo "===========> Building docker image $(IMAGE) $(VERSION)"
$(DOCKER) buildx build -f $(ROOT_DIR)/Dockerfile --pull --no-cache --platform=$(PLATFORMS) --push . -t $(REGISTRY_PREFIX)/$(IMAGE)-$(ARCH):$(VERSION)
## image.push: Push docker images
.PHONY: image.push
image.push: image.verify go.build.verify $(addprefix image.push., $(addprefix $(IMAGE_PLAT)., $(IMAGES)))