Makefile 1.1 KB

12345678910111213141516171819202122232425
  1. VERSION=$(shell git describe --tags --always)
  2. .PHONY: docker
  3. docker: # Compile and build the docker | 编译并构建 docker 镜像
  4. pnpm install
  5. pnpm build
  6. docker build -f Dockerfile -t ${DOCKER_USERNAME}/backend-ui:${VERSION} .
  7. .PHONY: docker-not-build
  8. docker-not-build: # Build the docker without compiling | 不编译直接构建镜像
  9. docker build -f Dockerfile -t ${DOCKER_USERNAME}/backend-ui:${VERSION} .
  10. .PHONY: publish-docker
  11. publish-docker: # Publish the docker | 发布镜像
  12. echo "${DOCKER_PASSWORD}" | docker login --username ${DOCKER_USERNAME} --password-stdin https://${REPO}
  13. docker push ${DOCKER_USERNAME}/backend-ui:${VERSION}
  14. .PHONY: run-docker
  15. run-docker: # Run the docker image | 运行 docker 镜像
  16. docker volume create backendui
  17. docker run -d --name ${DOCKER_USERNAME}/backend-ui:${VERSION} -p 80:80 -v backendui:/etc/nginx --network docker-compose_simple-admin ${DOCKER_USERNAME}/backendui:${VERSION}
  18. .PHONY: help
  19. help: # Show help | 显示帮助
  20. @grep -E '^[a-zA-Z0-9 -]+:.*#' Makefile | sort | while read -r l; do printf "\033[1;32m$$(echo $$l | cut -f 1 -d':')\033[00m:$$(echo $$l | cut -f 2- -d'#')\n"; done