docker/

directory
v1.5.8 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 4, 2022 License: Apache-2.0

README

Docker example

1. How to run

This example shows developers how to build your server using dubbo-go framework to docker.

run :

sudo sh docker_run.sh

Then you can build and pack your server to running docker.

docker file:
FROM golang:latest as build
ENV GO111MODULE on
ENV CONF_PROVIDER_FILE_PATH  /release/conf/server.yml
ADD ./go-server/dist/linux_amd64/ /
ENTRYPOINT exec /release/go-server
2. Attention

in docker_run.sh

P_DIR=$(pwd)/go-server
make GOOS="linux" PROJECT_DIR=$P_DIR PROJECT_NAME=$(basename $P_DIR) BASE_DIR=$P_DIR/dist -f ../build/Makefile build
docker build --no-cache -t dubbogo-docker-sample .
docker run --name zkserver -p 2181:2181 --restart always -d zookeeper:3.4.9
docker run -e DUBBO_IP_TO_REGISTRY=127.0.0.1  -p 20000:20000  --link zkserver:zkserver dubbogo-docker-sample
  • first start zookeeper as registry
  • second we should set ip_to_registry environment.
    Docker bridge network mode need to specify a registered host IP for external network communication. Dubbo provides two pairs of system attributes in the startup phase, which are used to set the IP and port addresses of external communication.
3. Test

in go-server/tests/integration/

run:

go test -tags integration -v .

You can get lines at the end of output:

--- PASS: TestGetUser (0.00s)
PASS
ok      github.com/apache/dubbo-go-samples/docker/go-server/tests/integration   3.612s

Directories

Path Synopsis
go-client
cmd command
pkg
go-server
cmd command
pkg

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL