-
Notifications
You must be signed in to change notification settings - Fork 55
Expand file tree
/
Copy pathDockerfile
More file actions
54 lines (36 loc) · 1.34 KB
/
Dockerfile
File metadata and controls
54 lines (36 loc) · 1.34 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
43
44
45
46
47
48
49
50
51
52
53
# Base builder image with all libraries installed, including the source of the project
FROM golang:1.25-bookworm AS builder
RUN apt-get update && \
apt-get install -y --no-install-recommends \
libostree-dev \
libglib2.0-dev \
btrfs-progs \
&& apt-get clean
WORKDIR /bblfsh
ADD go.mod ./
ADD go.sum ./
RUN go mod download
ADD . .
# Actual build image that compiles bblfshd and bblfshctl
FROM builder AS binbuild
RUN mkdir /build
ARG BBLFSHD_VERSION=dev
ARG BBLFSHD_BUILD=undefined
ENV GO_LDFLAGS="-X 'main.version=${BBLFSHD_VERSION}' -X 'main.build=${BBLFSHD_BUILD}'"
RUN go build -tags ostree,containers_image_ostree --ldflags "${GO_LDFLAGS}" -o /build/bblfshd ./cmd/bblfshd/
RUN go build --ldflags "${GO_LDFLAGS}" -o /build/bblfshctl ./cmd/bblfshctl/
# Final image for bblfshd
FROM debian:bookworm-slim
RUN apt-get update && \
apt-get install -y --no-install-recommends --no-install-suggests \
ca-certificates \
libostree-1-1 \
&& apt-get clean
ENV TINI_VERSION=v0.18.0
ADD https://github.com/krallin/tini/releases/download/${TINI_VERSION}/tini /tini
RUN chmod +x /tini
COPY --from=binbuild build /opt/bblfsh/bin/
ADD etc /opt/bblfsh/etc/
ENV PATH="/opt/bblfsh/bin:${PATH}"
# Run bblfshd under Tini (see https://github.com/krallin/tini/issues/8 for details)
ENTRYPOINT ["/tini", "--", "bblfshd"]