blob: 9d248674a54248dbfaddb399dc4adbb122cc9518 [file] [log] [blame]
Akron50d5f832025-06-06 15:08:04 +02001# Build stage
2FROM golang:latest AS build
3
4RUN apt-get update && \
5 apt-get upgrade -y ca-certificates
6
7WORKDIR /src
8
9COPY go.mod go.sum ./
10RUN go mod download
11
12COPY . /src
13
14RUN CGO_ENABLED=0 go test ./...
15
16# Build static
17RUN CGO_ENABLED=0 GOOS=linux GOARCH=amd64 \
18 go build -v \
19 -ldflags "-extldflags '-static' -s -w" \
20 --trimpath \
21 -o /src/termmapper ./cmd/termmapper/
22
23FROM gruebel/upx:latest AS upx
24
25COPY --from=build /src/termmapper /termmapper-big
26
27# Compress the binary and copy it to final image
28RUN upx --best --lzma -o /termmapper /termmapper-big
29
30# Main stage
31FROM scratch AS final
32
33WORKDIR /
34
35EXPOSE 5725
36
37COPY --from=build /etc/ssl/certs /etc/ssl/certs
38COPY --from=build /src/mappings /mappings
39COPY --from=upx /termmapper /termmapper
40
41ENTRYPOINT [ "/termmapper" ]
42
43LABEL maintainer="korap@ids-mannheim.de"
44LABEL description="Docker Image for KoralPipe-TermMapper"
45LABEL repository="https://github.com/KorAP/KoralPipe-TermMapper"
46
47# docker build -f Dockerfile -t korap/koralpipe-termmapper:latest .
48# docker run --rm --network host korap/koralpipe-termmapper:latest -m /mappings/*.yaml