-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
28 lines (22 loc) · 815 Bytes
/
Dockerfile
File metadata and controls
28 lines (22 loc) · 815 Bytes
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
# syntax=docker/dockerfile:1
FROM golang:1.26.0 AS builder
WORKDIR /src
COPY . ./
ENV CGO_ENABLED=0
ARG HASHBOX_REVISION
ARG HASHBOX_VERSION
RUN --mount=type=cache,target=/go/pkg/mod \
--mount=type=cache,target=/root/.cache/go-build \
echo "Building version ${HASHBOX_VERSION} (${HASHBOX_REVISION})"; \
if [ -n "${HASHBOX_REVISION}" ]; then \
LDFLAGS="-s -w -X main.Version=${HASHBOX_REVISION}"; \
else \
LDFLAGS="-s -w"; \
fi; \
(cd server && go build -ldflags="$LDFLAGS" -o /out/hashbox-server .) && \
(cd util && go build -ldflags="$LDFLAGS" -o /out/hashbox-util .)
FROM gcr.io/distroless/static:nonroot
COPY --from=builder /out/hashbox-server /usr/local/bin/hashbox-server
COPY --from=builder /out/hashbox-util /usr/local/bin/hashbox-util
WORKDIR /
EXPOSE 7411