GithubHelp home page GithubHelp logo

deploy_bubble_using_docker's People

Contributors

dependabot[bot] avatar q1mi avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

deploy_bubble_using_docker's Issues

docker-compose 中的启动顺序未生效,报连接数据库失败 (blog项目依赖mysql)

version: "3.7"
services:
  blog:
    container_name: blog
    build: .
    command: sh -c "./wait-for-it.sh mysql:3306 -- ./blog-service"
    depends_on:
      - mysql
    ports:
      - "8889:8888"
    expose:
      - "8889"
    privileged: true
  mysql:
    container_name: mysql
    image: "mysql:5.7.22"
    ports:
      - "33061:3306"
    privileged: true
    environment:
      MYSQL_ROOT_PASSWORD: "root"
      MYSQL_DATABASE: "blog_service"
      MYSQL_PASSWORD: "root"
      MYSQL_ROOT_HOST: '%'
    volumes:
      - ./docs/mysql:/var/lib/mysql
      - ./docs/sql/blog_service.sql:/docker-entrypoint-initdb.d/blog.sql
    command: [
      '--character-set-server=utf8mb4',
      '--collation-server=utf8mb4_unicode_ci'
    ]
FROM golang:alpine AS builder

# 为我们的镜像设置必要的环境变量
ENV GO111MODULE=on \
    CGO_ENABLED=0 \
    GOOS=linux \
    GOARCH=amd64

# 移动到工作目录:/build
WORKDIR /build
RUN go env -w GO111MODULE=on
RUN go env -w GOPROXY=https://goproxy.cn,https://mirrors.aliyun.com/goproxy/,direct
# 复制项目中的 go.mod 和 go.sum文件并下载依赖信息
COPY go.mod .
COPY go.sum .
RUN go mod download

# 将代码复制到容器中
COPY . .


# 将我们的代码编译成二进制可执行文件 blog-service
RUN go build -o blog-service .

###################
# 接下来创建一个小镜像
###################
#FROM scratch
#apt-get需要
FROM debian:stretch-slim

COPY ./configs /configs
COPY ./wait-for-it.sh /

# 从builder镜像中把/dist/app 拷贝到当前目录
COPY --from=builder /build/blog-service /

RUN set -eux; \
	apt-get update; \
	apt-get install -y \
		--no-install-recommends \
		netcat; \
        chmod 755 wait-for-it.sh

# 需要运行的命令 docker run --name blog -it -p 8888:8888 blog-service
ENTRYPOINT ["/blog-service"]
➜  blog-service git:(master) ✗ docker-compose  up
Creating network "blog-service_default" with the default driver
Creating mysql ... done
Creating blog  ... done
Attaching to mysql, blog
blog     | 2020/12/14 08:47:26 init.setupDBEngine err: dial tcp 192.168.192.2:3306: connect: connection refused
blog exited with code 1
mysql    | 2020-12-14T08:47:26.710744Z 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details).
mysql    | 2020-12-14T08:47:26.718127Z 0 [Note] mysqld (mysqld 5.7.22) starting as process 1 ...
mysql    | 2020-12-14T08:47:26.732595Z 0 [Note] InnoDB: PUNCH HOLE support available
mysql    | 2020-12-14T08:47:26.732686Z 0 [Note] InnoDB: Mutexes and rw_locks use GCC atomic builtins
mysql    | 2020-12-14T08:47:26.732707Z 0 [Note] InnoDB: Uses event mutexes
mysql    | 2020-12-14T08:47:26.732721Z 0 [Note] InnoDB: GCC builtin __atomic_thread_fence() is used for memory barrier
mysql    | 2020-12-14T08:47:26.732734Z 0 [Note] InnoDB: Compressed tables use zlib 1.2.3
mysql    | 2020-12-14T08:47:26.732747Z 0 [Note] InnoDB: Using Linux native AIO
mysql    | 2020-12-14T08:47:26.733754Z 0 [Note] InnoDB: Number of pools: 1

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.