q1mi / deploy_bubble_using_docker Goto Github PK
View Code? Open in Web Editor NEWdeploy bubble app using docker
deploy bubble app using docker
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
go: github.com/gin-gonic/[email protected]: Get "https://proxy.golang.org/github.com/gin-gonic/gin/@v/v1.5.0.mod": dial tcp 216.58. 200.241:443: i/o timeout
ERROR: Service 'bubble_app' failed to build: The command '/bin/sh -c go mod download' returned a non-zero code: 1
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.