forked from ByteStorage/FlyDB
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
35 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
FROM ubuntu:18.04 | ||
|
||
WORKDIR /app | ||
|
||
COPY bin/flydb-server /app/flydb-server | ||
|
||
RUN chmod +x /app/flydb-server | ||
|
||
CMD ["/app/flydb-server"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,18 +1,39 @@ | ||
#!/bin/bash | ||
|
||
DOCKER_USERNAME="$DOCKER_USERNAME" | ||
IMAGE_NAME="$IMAGE_NAME" | ||
TAG="$TAG" | ||
# 提示用户输入 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 | ||
|
||
# check docker command | ||
if ! [ -x "$(command -v docker)" ]; then | ||
echo "Docker is not installed" | ||
exit 1 | ||
fi | ||
|
||
# check go command | ||
if ! [ -x "$(command -v go)" ]; then | ||
echo "Go is not installed" | ||
exit 1 | ||
fi | ||
|
||
# check environment variables | ||
if [ -z "$DOCKER_USERNAME" ] || [ -z "$IMAGE_NAME" ] || [ -z "$TAG" ]; then | ||
echo "Please set DOCKER_USERNAME, IMAGE_NAME and TAG environment variables" | ||
exit 1 | ||
fi | ||
|
||
docker build -t $DOCKER_USERNAME/$IMAGE_NAME:$TAG . | ||
go build -o bin/flydb-server cmd/server/cli/flaydb-server.go | ||
|
||
# build docker image | ||
docker build -t DOCKER_USERNAME/IMAGE_NAME:TAG -f docker/Dockerfile . | ||
|
||
# docker login | ||
|
||
docker push $DOCKER_USERNAME/$IMAGE_NAME:$TAG | ||
# push docker image | ||
docker push DOCKER_USERNAME/IMAGE_NAME:TAG | ||
|
||
# docker rmi $DOCKER_USERNAME/$IMAGE_NAME:$TAG |