Created
May 13, 2026 06:38
-
-
Save pratikbin/05a702d40e207093e5b1f34f53622ec5 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # --- UI Build Stage --- | |
| FROM node:25-alpine3.23 AS ui-builder | |
| WORKDIR /app | |
| COPY ui/package*.json ./ | |
| RUN npm ci | |
| COPY ui/ ./ | |
| RUN npm run build-enterprise | |
| # --- Go Build Stage: Debian/glibc for dynamic-linked CGO --- | |
| FROM golang:1.26.2-bookworm AS builder | |
| WORKDIR /app | |
| RUN apt-get update && apt-get install -y --no-install-recommends \ | |
| gcc libc6-dev libsqlite3-dev \ | |
| && rm -rf /var/lib/apt/lists/* | |
| ENV CGO_ENABLED=1 GOOS=linux | |
| COPY transports/go.mod transports/go.sum ./ | |
| RUN go mod download | |
| COPY transports/ ./ | |
| COPY --from=ui-builder /app/out ./bifrost-http/ui | |
| ENV GOWORK=off | |
| ARG VERSION=unknown | |
| # Dynamic-linked build for Go plugin (.so) support: | |
| # - No -extldflags '-static' | |
| # - No sqlite_static tag (use system libsqlite3) | |
| RUN go build \ | |
| -ldflags="-w -s -X main.Version=v${VERSION}" \ | |
| -trimpath \ | |
| -o /app/main \ | |
| ./bifrost-http | |
| RUN test -f /app/main | |
| # --- Runtime: Debian slim (glibc) --- | |
| FROM debian:bookworm-slim | |
| WORKDIR /app | |
| RUN apt-get update && apt-get install -y --no-install-recommends \ | |
| ca-certificates wget libsqlite3-0 \ | |
| && rm -rf /var/lib/apt/lists/* \ | |
| && useradd -m -s /bin/sh appuser | |
| COPY --from=builder /app/main . | |
| COPY --from=builder /app/docker-entrypoint.sh . | |
| ARG ARG_APP_PORT=8080 | |
| ARG ARG_APP_HOST=0.0.0.0 | |
| ARG ARG_LOG_LEVEL=info | |
| ARG ARG_LOG_STYLE=json | |
| ARG ARG_APP_DIR=/app/data | |
| ENV APP_PORT=$ARG_APP_PORT \ | |
| APP_HOST=$ARG_APP_HOST \ | |
| LOG_LEVEL=$ARG_LOG_LEVEL \ | |
| LOG_STYLE=$ARG_LOG_STYLE \ | |
| APP_DIR=$ARG_APP_DIR \ | |
| GOGC="" \ | |
| GOMEMLIMIT="" | |
| RUN mkdir -p $APP_DIR/logs && \ | |
| chown -R appuser:appuser /app && \ | |
| chmod +x /app/docker-entrypoint.sh | |
| USER appuser | |
| VOLUME ["/app/data"] | |
| EXPOSE $APP_PORT | |
| HEALTHCHECK --interval=30s --timeout=10s --start-period=5s --retries=3 \ | |
| CMD wget --no-verbose --tries=1 -O /dev/null http://127.0.0.1:${APP_PORT}/health || exit 1 | |
| ENTRYPOINT ["/app/docker-entrypoint.sh"] | |
| CMD ["/app/main"] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment