-
Notifications
You must be signed in to change notification settings - Fork 4
/
Dockerfile
25 lines (24 loc) · 1.12 KB
/
Dockerfile
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
# build env
FROM golang:1.21 AS build-env
COPY go.mod go.sum /src/
WORKDIR /src
RUN go mod download
COPY . .
ARG TARGETOS
ARG TARGETARCH
ARG release=
RUN <<EOR
VERSION=$(git rev-parse --short HEAD)
BUILDTIME=$(date -u '+%Y-%m-%dT%H:%M:%SZ')
RELEASE=$release
CGO_ENABLED=0 GOOS=$TARGETOS GOARCH=$TARGETARCH go build -o /app/blob-sender -ldflags="-s -w -X 'github.com/ethpandaops/goomy-blob/utils.BuildVersion=${VERSION}' -X 'github.com/ethpandaops/goomy-blob/utils.BuildRelease=${RELEASE}' -X 'github.com/ethpandaops/goomy-blob/utils.Buildtime=${BUILDTIME}'" ./cmd/blob-sender
CGO_ENABLED=0 GOOS=$TARGETOS GOARCH=$TARGETARCH go build -o /app/blob-spammer -ldflags="-s -w -X 'github.com/ethpandaops/goomy-blob/utils.BuildVersion=${VERSION}' -X 'github.com/ethpandaops/goomy-blob/utils.BuildRelease=${RELEASE}' -X 'github.com/ethpandaops/goomy-blob/utils.Buildtime=${BUILDTIME}'" ./cmd/blob-spammer
EOR
# final stage
FROM debian:stable-slim
WORKDIR /app
RUN apt-get update && apt-get install -y --no-install-recommends ca-certificates
RUN update-ca-certificates
ENV PATH="$PATH:/app"
COPY --from=build-env /app/* /app
CMD ["./blob-spammer"]