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
113 lines (87 loc) · 4.78 KB

File metadata and controls

113 lines (87 loc) · 4.78 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
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
# This script is for PR preview and demo.bytebase.com on Render ONLY.
FROM node:22.12.0 as frontend
# RENDER_GIT_COMMIT is a render.com provided env var during build.
# https://render.com/docs/environment-variables
ARG RENDER_GIT_COMMIT="unknown"
ARG RELEASE="dev"
RUN npm i -g pnpm
WORKDIR /frontend-build
COPY . .
ENV BB_GIT_COMMIT_ID_FE="${RENDER_GIT_COMMIT}"
RUN cd frontend && pnpm install --frozen-lockfile && pnpm release-docker
FROM golang:1.23.4 as backend
ADD go.mod go.sum /
RUN go mod download
ARG GO_VERSION="1.23.4"
# RENDER_GIT_COMMIT is a render.com provided env var during build.
# https://render.com/docs/environment-variables
ARG RENDER_GIT_COMMIT="unknown"
ARG BUILD_TIME="unknown"
ARG BUILD_USER="unknown"
ARG RELEASE="dev"
# Need gcc for CGO_ENABLED=1
RUN apt-get install -y gcc
RUN apt-get update && apt-get install -y libkrb5-dev
WORKDIR /backend-build
COPY . .
# Copy frontend asset
COPY --from=frontend /frontend-build/frontend/dist ./backend/server/dist
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 go build \
--tags "${RELEASE},embed_frontend,minidemo,docker" \
-ldflags="-w -s -X 'github.com/bytebase/bytebase/backend/bin/server/cmd.version=${VERSION}' -X 'github.com/bytebase/bytebase/backend/bin/server/cmd.goversion=${GO_VERSION}' -X 'github.com/bytebase/bytebase/backend/bin/server/cmd.gitcommit=${RENDER_GIT_COMMIT}' -X 'github.com/bytebase/bytebase/backend/bin/server/cmd.buildtime=${BUILD_TIME}' -X 'github.com/bytebase/bytebase/backend/bin/server/cmd.builduser=${BUILD_USER}'" \
-o bytebase \
./backend/bin/server/main.go
# Use debian to decompress tar files.
FROM debian:bookworm-slim as decompressor
ARG TARGETARCH
RUN apt-get update && apt-get install -y xz-utils
COPY ./backend/resources /tmp/bytebase/resources/
# These paths must match the paths in backened/resources/utils/utils_dir.go.
# The real resource dir is decided by the backend at runtime. But we can only extract these at build time.
# we extract resources to a specific dir here and the backend will create symlinks at runtime.
RUN mkdir -p /var/opt/bytebase/resources/mongoutil-1.6.1-linux-${TARGETARCH}/
RUN tar -Jxf /tmp/bytebase/resources/mongoutil/mongoutil-1.6.1-linux-${TARGETARCH}.txz -C /var/opt/bytebase/resources/mongoutil-1.6.1-linux-${TARGETARCH}/
RUN mkdir -p /var/opt/bytebase/resources/mysqlutil-8.0.33-linux-${TARGETARCH}/
RUN tar -zxf /tmp/bytebase/resources/mysqlutil/mysqlutil-8.0.33-linux-${TARGETARCH}.tar.gz -C /var/opt/bytebase/resources/mysqlutil-8.0.33-linux-${TARGETARCH}/
RUN mkdir -p /var/opt/bytebase/resources/postgres-linux-${TARGETARCH}-16
RUN tar -Jxf /tmp/bytebase/resources/postgres/postgres-linux-${TARGETARCH}.txz -C /var/opt/bytebase/resources/postgres-linux-${TARGETARCH}-16/
# Use debian because mysql requires glibc.
FROM debian:bookworm-slim as monolithic
ARG VERSION="development"
ARG RENDER_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=${RENDER_GIT_COMMIT}
LABEL org.opencontainers.image.created=${BUILD_TIME}
LABEL org.opencontainers.image.authors=${BUILD_USER}
# Create user "bytebase" for running Postgres database and server.
RUN addgroup --gid 113 --system bytebase && adduser --uid 113 --system bytebase && adduser bytebase bytebase
# Directory to store the data, which can be referenced as the mounting point.
RUN mkdir -p /var/opt/bytebase
# Directory to store the demo data.
RUN mkdir -p /var/opt/bytebase/pgdata-demo
# Our HEALTHCHECK instruction in dockerfile needs curl.
# Install psmisc to use killall command in demo.sh used by render.com.
RUN apt-get update && apt-get install -y locales curl psmisc procps libncurses5
# Generate en_US.UTF-8 locale which is needed to start postgres server.
# Fix the posgres server issue (invalid value for parameter "lc_messages": "en_US.UTF-8").
RUN echo "en_US.UTF-8 UTF-8" > /etc/locale.gen && locale-gen
ENV PATH="${PATH}:/var/opt/bytebase/resources/postgres-linux-amd64-16/bin"
# Copy utility scripts, we have
# - Demo script to launch Bytebase in readonly demo mode
COPY ./scripts /usr/local/bin/
COPY ./scripts/.psqlrc /root/.psqlrc
# The file indicates running in docker environment.
RUN touch /etc/bb.env
COPY --from=backend /backend-build/bytebase /usr/local/bin/
COPY --from=backend /etc/ssl/certs /etc/ssl/certs
COPY --from=decompressor /var/opt/bytebase/resources /bytebase/resources
ENV OPENSSL_CONF /etc/ssl/
CMD ["--port", "8080", "--data", "/var/opt/bytebase"]
HEALTHCHECK --interval=5m --timeout=60s CMD curl -f http://localhost:8080/healthz || exit 1
ENTRYPOINT ["bytebase"]
Morty Proxy This is a proxified and sanitized view of the page, visit original site.