-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathbare.Dockerfile
More file actions
48 lines (37 loc) · 1.75 KB
/
Copy pathbare.Dockerfile
File metadata and controls
48 lines (37 loc) · 1.75 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
FROM golang:1.25 AS build
ARG GIT_SHA
ARG GIT_REF_NAME
WORKDIR /src
ENV GOMODCACHE=/tmp/gomodcache
ENV GOCACHE=/tmp/gocache
RUN apt-get update && \
apt-get install -y --no-install-recommends brotli && \
rm -rf /var/lib/apt/lists/*
COPY go.mod go.sum ./
RUN go mod download
COPY . .
RUN mkdir -p /out && \
CGO_ENABLED=0 go build \
-ldflags "-X github.com/sandialabs/bibcheck/version.gitSha=${GIT_SHA} -X github.com/sandialabs/bibcheck/version.gitRefName=${GIT_REF_NAME}" \
-o /out/bibcheck . && \
GOOS=js GOARCH=wasm go build \
-ldflags "-X github.com/sandialabs/bibcheck/version.gitSha=${GIT_SHA} -X github.com/sandialabs/bibcheck/version.gitRefName=${GIT_REF_NAME}" \
-o /out/app.wasm ./web/app && \
cp "$(go env GOROOT)/lib/wasm/wasm_exec.js" /out/wasm_exec.js && \
cp web/static/*.html /out/ && \
cp web/static/*.css /out/ && \
cp web/static/*.svg /out/ && \
for file in /out/*.wasm /out/*.html /out/*.css /out/*.js; do gzip -k -f "$file" && brotli -k -f "$file"; done && \
chmod -R g=u /out
FROM registry.access.redhat.com/ubi9/ubi-minimal:latest
LABEL org.opencontainers.image.source https://github.com/sandialabs/bibcheck
COPY --from=build --chown=1001:0 /out/bibcheck /usr/local/bin/bibcheck
COPY --from=build --chown=1001:0 /out/app.wasm* /opt/bibcheck/web/
COPY --from=build --chown=1001:0 /out/wasm_exec.js* /opt/bibcheck/web/
COPY --from=build --chown=1001:0 /out/index.html* /opt/bibcheck/web/
COPY --from=build --chown=1001:0 /out/favicon.svg /opt/bibcheck/web/
COPY --from=build --chown=1001:0 /out/style.css* /opt/bibcheck/web/
COPY --from=build --chown=1001:0 /out/footer.css* /opt/bibcheck/web/
EXPOSE 8080
USER 1001
CMD ["bibcheck", "serve", "--addr", ":8080", "--web-dir", "/opt/bibcheck/web"]