1 Star 0 Fork 22

flashpig8014 / Bytebase

forked from Gitee 极速下载 / Bytebase 
加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
Dockerfile.sql-service 2.09 KB
一键复制 编辑 原始数据 按行查看 历史
Danny Xu 提交于 2022-09-06 10:38 . chore: upgrade to go 1.19 (#2532)
# DO NOT run docker build against this file directly. Instead using ./build_docker.sh as that
# one sets the various ARG used in the Dockerfile
# After build
# $ docker run --init --rm --name sql-service --publish 8081:8081 bytebase/sql
FROM golang:1.19 as sql
ARG VERSION="development"
ARG GO_VERSION="1.19"
ARG GIT_COMMIT="unknown"
ARG BUILD_TIME="unknown"
ARG BUILD_USER="unknown"
ARG RELEASE="release"
# Need gcc for CGO_ENABLED=1
RUN apt-get install -y gcc
WORKDIR /sql-service-build
COPY . .
COPY ./scripts/VERSION .
# -ldflags="-w -s" means omit DWARF symbol table and the symbol table and debug information
# go-sqlite3 requires CGO_ENABLED
RUN VERSION=`cat ./VERSION` && CGO_ENABLED=1 GOOS=linux GOARCH=amd64 go build \
--tags "${RELEASE}" \
-ldflags="-w -s -X 'github.com/bytebase/bytebase/bin/sql-service/cmd.version=${VERSION}' -X 'github.com/bytebase/bytebase/bin/sql-service/cmd.goversion=${GO_VERSION}' -X 'github.com/bytebase/bytebase/bin/sql-service/cmd.gitcommit=${GIT_COMMIT}' -X 'github.com/bytebase/bytebase/bin/sql-service/cmd.buildtime=${BUILD_TIME}' -X 'github.com/bytebase/bytebase/bin/sql-service/cmd.builduser=${BUILD_USER}'" \
-o sql-service \
./bin/sql-service/main.go
# Use debian because mysql requires glibc.
FROM debian:bullseye-slim as monolithic
ARG VERSION="development"
ARG GIT_COMMIT="unknown"
ARG BUILD_TIME="unknown"
ARG BUILD_USER="unknown"
# See https://github.com/opencontainers/image-spec/blob/master/annotations.md
LABEL org.opencontainers.image.version=${VERSION}
LABEL org.opencontainers.image.revision=${GIT_COMMIT}
LABEL org.opencontainers.image.created=${BUILD_TIME}
LABEL org.opencontainers.image.authors=${BUILD_USER}
# Our HEALTHCHECK instruction in dockerfile needs curl.
RUN apt-get update && apt-get install -y curl
COPY --from=sql /sql-service-build/sql-service /usr/local/bin/
COPY --from=sql /etc/ssl/certs /etc/ssl/certs
# Copy utility scripts
COPY ./scripts /usr/local/bin/
CMD ["--host", "http://localhost", "--port", "80"]
HEALTHCHECK --interval=5m --timeout=60s CMD curl -f http://localhost:80/healthz || exit 1
ENTRYPOINT ["sql-service"]
1
https://gitee.com/flashpig8014/Bytebase.git
git@gitee.com:flashpig8014/Bytebase.git
flashpig8014
Bytebase
Bytebase
main

搜索帮助