Skip to content

Commit

Permalink
recover docker
Browse files Browse the repository at this point in the history
  • Loading branch information
sjcsjc123 committed Jan 23, 2024
1 parent bfc8560 commit d479500
Showing 1 changed file with 4 additions and 16 deletions.
20 changes: 4 additions & 16 deletions hack/build-docker-image.sh
Original file line number Diff line number Diff line change
@@ -1,12 +1,8 @@
#!/bin/bash

# 提示用户输入 Docker Hub 相关信息
# shellcheck disable=SC2162
read -p "Please enter your Docker Hub username: " DOCKER_USERNAME
# shellcheck disable=SC2162
read -p "Please enter image name: " IMAGE_NAME
# shellcheck disable=SC2162
read -p "Please enter image tag: " TAG
DOCKER_USERNAME="${DOCKER_USERNAME:-bytestorage}"
IMAGE_NAME="${IMAGE_NAME:-flydb}"
TAG="${TAG:-latest}"

# check docker command
if ! [ -x "$(command -v docker)" ]; then
Expand All @@ -20,24 +16,16 @@ if ! [ -x "$(command -v go)" ]; then
exit 1
fi

# check environment variables
if [ -z "$DOCKER_USERNAME" ] || [ -z "$IMAGE_NAME" ] || [ -z "$TAG" ]; then
if [ -z "$IMAGE_NAME" ] || [ -z "$TAG" ]; then
echo "Please set DOCKER_USERNAME, IMAGE_NAME and TAG environment variables"
exit 1
fi

go build -o bin/flydb-server cmd/server/cli/flydb-server.go

echo "DOCKER_USERNAME: $DOCKER_USERNAME"
echo "IMAGE_NAME: $IMAGE_NAME"
echo "TAG: $TAG"

# build docker image
docker build -t "$DOCKER_USERNAME/$IMAGE_NAME:$TAG" -f docker/Dockerfile .

# docker login

# push docker image
docker push "$DOCKER_USERNAME/$IMAGE_NAME:$TAG"

# docker rmi $DOCKER_USERNAME/$IMAGE_NAME:$TAG

0 comments on commit d479500

Please sign in to comment.