-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
38 lines (27 loc) · 819 Bytes
/
Dockerfile
File metadata and controls
38 lines (27 loc) · 819 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
29
30
31
32
33
34
35
36
37
38
FROM --platform=$BUILDPLATFORM golang:1.23-alpine AS builder
RUN apk --no-cache add ca-certificates
RUN apk add --no-cache tzdata
WORKDIR /app
COPY go.mod ./
COPY go.sum ./
RUN go mod download
COPY . ./
ARG TARGETOS
ARG TARGETARCH
RUN GOOS=$TARGETOS GOARCH=$TARGETARCH go build -o /mpbench
##
## Deploy
##
FROM alpine:3.21
# Install git and newer docker client from the community repository
RUN apk add --no-cache git
RUN apk add --no-cache docker
# Script to handle docker login
COPY scripts/docker-login.sh /docker-login.sh
RUN chmod +x /docker-login.sh
WORKDIR /
COPY --from=builder /mpbench /mpbench
COPY --from=builder /usr/share/zoneinfo /usr/share/zoneinfo
ENV TZ=America/Los_Angeles
# Use shell form to allow environment variable expansion
ENTRYPOINT ["/bin/sh", "-c", "/docker-login.sh && /mpbench"]