2024-09-05 20:00:27 +00:00
|
|
|
FROM node:18-alpine3.19 AS node-alpine
|
|
|
|
|
FROM golang:1.22.2-alpine3.19 AS go-alpine
|
|
|
|
|
|
|
|
|
|
# ------ Build Zoekt ------
|
|
|
|
|
FROM go-alpine AS zoekt-builder
|
|
|
|
|
RUN apk add --no-cache ca-certificates
|
|
|
|
|
WORKDIR /zoekt
|
|
|
|
|
COPY vendor/zoekt/go.mod vendor/zoekt/go.sum ./
|
|
|
|
|
RUN go mod download
|
|
|
|
|
COPY vendor/zoekt ./
|
|
|
|
|
RUN CGO_ENABLED=0 GOOS=linux go build -o /cmd/ ./cmd/...
|
|
|
|
|
|
|
|
|
|
# ------ Build Web ------
|
|
|
|
|
FROM node-alpine AS web-builder
|
|
|
|
|
RUN apk add --no-cache libc6-compat
|
|
|
|
|
WORKDIR /app
|
|
|
|
|
COPY package.json yarn.lock* ./
|
2024-09-06 18:27:20 +00:00
|
|
|
|
|
|
|
|
# Fixes arm64 timeouts
|
2024-09-06 02:23:06 +00:00
|
|
|
RUN yarn config set registry https://registry.npmjs.org/
|
|
|
|
|
RUN yarn config set network-timeout 1200000
|
|
|
|
|
RUN yarn --frozen-lockfile
|
2024-09-05 20:00:27 +00:00
|
|
|
COPY . .
|
|
|
|
|
ENV NEXT_TELEMETRY_DISABLED=1
|
2024-09-17 04:37:34 +00:00
|
|
|
# @see: https://phase.dev/blog/nextjs-public-runtime-variables/
|
|
|
|
|
ARG NEXT_PUBLIC_SOURCEBOT_TELEMETRY_DISABLED=BAKED_NEXT_PUBLIC_SOURCEBOT_TELEMETRY_DISABLED
|
2024-09-05 20:00:27 +00:00
|
|
|
RUN yarn run build
|
|
|
|
|
|
|
|
|
|
# ------ Runner ------
|
|
|
|
|
FROM node-alpine AS runner
|
|
|
|
|
WORKDIR /app
|
|
|
|
|
ENV NODE_ENV=production
|
|
|
|
|
ENV NEXT_TELEMETRY_DISABLED=1
|
|
|
|
|
ENV DATA_DIR=/data
|
2024-09-28 06:38:32 +00:00
|
|
|
ENV CONFIG_PATH=$DATA_DIR/config.json
|
2024-09-05 20:00:27 +00:00
|
|
|
ENV DATA_CACHE_DIR=$DATA_DIR/.sourcebot
|
|
|
|
|
|
2024-09-28 23:47:07 +00:00
|
|
|
# @note: This is also set in .env
|
|
|
|
|
ENV NEXT_PUBLIC_POSTHOG_KEY=phc_VFn4CkEGHRdlVyOOw8mfkoj1DKVoG6y1007EClvzAnS
|
|
|
|
|
|
2024-09-17 04:37:34 +00:00
|
|
|
# Sourcebot collects anonymous usage data using [PostHog](https://posthog.com/). Uncomment this line to disable.
|
|
|
|
|
# ENV SOURCEBOT_TELEMETRY_DISABLED=1
|
|
|
|
|
|
2024-09-05 20:00:27 +00:00
|
|
|
# Configure dependencies
|
2024-09-28 23:47:07 +00:00
|
|
|
RUN apk add --no-cache git ca-certificates bind-tools tini jansson wget supervisor uuidgen curl
|
2024-09-05 20:00:27 +00:00
|
|
|
|
|
|
|
|
# Configure zoekt
|
|
|
|
|
COPY vendor/zoekt/install-ctags-alpine.sh .
|
|
|
|
|
RUN ./install-ctags-alpine.sh && rm install-ctags-alpine.sh
|
|
|
|
|
RUN mkdir -p ${DATA_CACHE_DIR}
|
|
|
|
|
COPY --from=zoekt-builder \
|
|
|
|
|
/cmd/zoekt-git-index \
|
|
|
|
|
/cmd/zoekt-indexserver \
|
|
|
|
|
/cmd/zoekt-mirror-github \
|
|
|
|
|
/cmd/zoekt-mirror-gitiles \
|
|
|
|
|
/cmd/zoekt-mirror-bitbucket-server \
|
|
|
|
|
/cmd/zoekt-mirror-gitlab \
|
|
|
|
|
/cmd/zoekt-mirror-gerrit \
|
|
|
|
|
/cmd/zoekt-webserver \
|
|
|
|
|
/usr/local/bin/
|
|
|
|
|
|
|
|
|
|
# Configure the webapp
|
|
|
|
|
COPY --from=web-builder /app/public ./public
|
|
|
|
|
RUN mkdir .next
|
|
|
|
|
COPY --from=web-builder /app/.next/standalone ./
|
|
|
|
|
COPY --from=web-builder /app/.next/static ./.next/static
|
|
|
|
|
|
|
|
|
|
COPY supervisord.conf /etc/supervisor/conf.d/supervisord.conf
|
|
|
|
|
COPY entrypoint.sh ./entrypoint.sh
|
|
|
|
|
RUN chmod +x ./entrypoint.sh
|
|
|
|
|
|
2024-09-25 03:56:51 +00:00
|
|
|
COPY sample-config.json .
|
|
|
|
|
|
2024-09-05 20:00:27 +00:00
|
|
|
EXPOSE 3000
|
|
|
|
|
ENV PORT=3000
|
|
|
|
|
ENV HOSTNAME="0.0.0.0"
|
|
|
|
|
ENTRYPOINT ["/sbin/tini", "--", "./entrypoint.sh"]
|