Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,6 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: docker/setup-qemu-action@v3
- uses: docker/setup-buildx-action@v3
- uses: docker/login-action@v3
with:
Expand Down
13 changes: 9 additions & 4 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,22 +1,27 @@
# syntax=docker/dockerfile:1

# Both build stages run on the build machine's own architecture (BUILDPLATFORM): the UI is the
# same files everywhere and Go cross-compiles, so a multi-arch build never runs under emulation.

# 1. Web UI (static files embedded into the binary)
FROM oven/bun:1.4-alpine AS web
FROM --platform=$BUILDPLATFORM oven/bun:1.4-alpine AS web
WORKDIR /src/web
COPY web/package.json web/bun.lock ./
RUN bun install --frozen-lockfile
COPY web/ ./
RUN bun run build

# 2. Server: pure Go, no cgo, so the result is one static file
FROM golang:1.26-alpine AS server
# 2. Server: pure Go, no cgo, so the result is one static file for the target platform
FROM --platform=$BUILDPLATFORM golang:1.26-alpine AS server
ARG TARGETOS
ARG TARGETARCH
WORKDIR /src
COPY go.mod go.sum ./
RUN go mod download
COPY . .
COPY --from=web /src/web/build ./web/build
ARG VERSION=dev
RUN CGO_ENABLED=0 go build -trimpath -ldflags "-s -w -X github.com/LowBloat/LowLex/internal/server.Version=${VERSION}" -o /out/lowlex ./cmd/lowlex \
RUN CGO_ENABLED=0 GOOS=${TARGETOS:-linux} GOARCH=${TARGETARCH:-amd64} go build -trimpath -ldflags "-s -w -X github.com/LowBloat/LowLex/internal/server.Version=${VERSION}" -o /out/lowlex ./cmd/lowlex \
&& mkdir -p /out/data

# 3. Runtime: CA certificates (for translation providers), time zones and a non-root user
Expand Down
Loading