Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Latest commit

 

History

History
History
64 lines (45 loc) · 2.2 KB

File metadata and controls

64 lines (45 loc) · 2.2 KB
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
# DO NOT run docker build against this file directly. Instead using ./build_bytebase_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.21.5 as sql
ADD go.mod go.sum /
RUN go mod download
ARG VERSION="development"
ARG GO_VERSION="1.21.5"
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/backend/bin/sql-service/cmd.version=${VERSION}' -X 'github.com/bytebase/bytebase/backend/bin/sql-service/cmd.goversion=${GO_VERSION}' -X 'github.com/bytebase/bytebase/backend/bin/sql-service/cmd.gitcommit=${GIT_COMMIT}' -X 'github.com/bytebase/bytebase/backend/bin/sql-service/cmd.buildtime=${BUILD_TIME}' -X 'github.com/bytebase/bytebase/backend/bin/sql-service/cmd.builduser=${BUILD_USER}'" \
-o sql-service \
./backend/bin/sql-service/main.go
# Use debian because mysql requires glibc.
FROM debian:bookworm-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 libncurses5
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", "8080"]
HEALTHCHECK --interval=5m --timeout=60s CMD curl -f http://localhost:8080/healthz || exit 1
ENTRYPOINT ["sql-service"]
Morty Proxy This is a proxified and sanitized view of the page, visit original site.