aboutsummaryrefslogtreecommitdiff
path: root/Dockerfile
blob: 11aac363bec09bd591529429a43696ce3f6e082c (plain)
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
# ---------- Build stage ----------
FROM alpine:3.20 AS builder

RUN apk add --no-cache \
    build-base \
    curl-dev \
    libxml2-dev \
    openssl-dev \
    git \
    pkgconf

WORKDIR /app
COPY . /app

RUN git clone https://git.bwaaa.monster/beaker /tmp/beaker && \
    cd /tmp/beaker && \
    make && make install && \
    rm -rf /tmp/beaker

RUN make clean && make && strip bin/omnisearch

# ---------- Runtime stage ----------
FROM alpine:3.20

RUN apk add --no-cache \
    libcurl \
    libxml2 \
    openssl

WORKDIR /app

# Copy only required artifacts
COPY --from=builder /app/bin/omnisearch /app/omnisearch
COPY --from=builder /usr/lib/libbeaker.so /usr/lib/libbeaker.so
COPY --from=builder /app/templates /app/templates
COPY --from=builder /app/static /app/static

# Security: non-root user
RUN adduser -D appuser && chmod +x /app/omnisearch
USER appuser

ENV LD_LIBRARY_PATH=/usr/lib

EXPOSE 5000

CMD ["/app/omnisearch"]