-
Notifications
You must be signed in to change notification settings - Fork 1
/
Containerfile.alpine
37 lines (23 loc) · 976 Bytes
/
Containerfile.alpine
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
FROM docker.io/golang:alpine as builder
WORKDIR /app
USER nobody
ENV HOME=/tmp GOPATH=/tmp
COPY go.mod go.sum ./
COPY . .
ARG CGO_ENABLED=0
RUN go mod download && go mod verify
RUN go build -ldflags="-s -w" -buildvcs=false -tags nomsgpack -o /go/text-extraction-service
FROM docker.io/alpine:latest
COPY --from=builder /go/text-extraction-service /usr/local/bin/text-extraction-service
# MuPDF is being installed as /usr/lib/libmupdf.so.24.10 (when version is 1.24.10)
# Symlink it to /usr/lib/libmupdf.so as this is a stable path
RUN apk update && apk add --no-cache mupdf-libs poppler-glib wv icu-libs && \
ln -s /usr/lib/libmupdf.so* /usr/lib/libmupdf.so && \
apk fetch --stdout libreoffice-common | tar xz usr/lib/libreoffice/program/libpdfiumlo.so && \
rm /var/cache/apk/*
USER nobody
# Expose the service and Nats (optional)
EXPOSE 4222 8080
VOLUME /tmp/nats
ENV GIN_MODE=release HOME=/tmp MUPDF_VERSION=1.24.10
CMD ["text-extraction-service"]