forked from livegrep/livegrep
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
42 lines (34 loc) · 1.11 KB
/
Dockerfile
File metadata and controls
42 lines (34 loc) · 1.11 KB
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
# Build stage — compile everything with Bazel
FROM ubuntu:24.04 AS builder
RUN apt-get update && DEBIAN_FRONTEND=noninteractive apt-get install -y \
build-essential \
git \
openjdk-21-jdk-headless \
python3 \
curl \
zip \
unzip \
&& rm -rf /var/lib/apt/lists/*
# Install Bazelisk (manages Bazel version via .bazelversion)
RUN curl -L https://github.com/bazelbuild/bazelisk/releases/download/v1.25.0/bazelisk-linux-amd64 \
-o /usr/local/bin/bazel && chmod +x /usr/local/bin/bazel
RUN useradd -m builder && mkdir -p /output && chown builder /output
WORKDIR /src
COPY --chown=builder . .
# Use CI bazelrc for optimized builds
RUN cp .bazelrc.ci .bazelrc
USER builder
RUN bazel build :livegrep \
&& mkdir -p /output \
&& tar -C /output -xf "$(bazel info bazel-bin)/livegrep.tar"
# Runtime stage
FROM ubuntu:24.04
RUN apt-get update \
&& apt-get -y dist-upgrade \
&& DEBIAN_FRONTEND=noninteractive apt-get install -y \
git \
openssh-client \
ca-certificates \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/*
COPY --from=builder /output/ /livegrep/