diff --git a/docker-bake.hcl b/docker-bake.hcl index 8157543dd1..ad20c497aa 100644 --- a/docker-bake.hcl +++ b/docker-bake.hcl @@ -151,6 +151,21 @@ target "traffic-generator-internal" { ] } +target "traffic-generator2" { + context = "." + dockerfile = "./trafficgenerator2.Dockerfile" + target = "generator2" + tags = ["${REGISTRY}/${REPO}/traffic-generator2:${BUILD_TAG}"] +} + +target "traffic-generator2-internal" { + inherits = ["traffic-generator2"] + tags = ["${REGISTRY}/eigenda-traffic-generator2:${BUILD_TAG}", + "${REGISTRY}/eigenda-traffic-generator2:${GIT_SHA}", + "${REGISTRY}/eigenda-traffic-generator2:sha-${GIT_SHORT_SHA}", + ] +} + target "dataapi" { context = "." dockerfile = "./Dockerfile" diff --git a/trafficgenerator2.Dockerfile b/trafficgenerator2.Dockerfile new file mode 100644 index 0000000000..3a1453c133 --- /dev/null +++ b/trafficgenerator2.Dockerfile @@ -0,0 +1,20 @@ +FROM golang:1.21.1-alpine3.18 as builder + +RUN apk add --no-cache make musl-dev linux-headers gcc git jq bash + +WORKDIR /app + +# Copy Entire Repo here in order to not copy individual dependencies +COPY . . + +WORKDIR /app/tools/traffic + +RUN --mount=type=cache,target=/go/pkg/mod \ + --mount=type=cache,target=/root/.cache/go-build \ + go build -o ./bin/generator ./cmd2 + +FROM alpine:3.18 as generator2 + +COPY --from=builder /app/tools/traffic/bin/generator /usr/local/bin + +ENTRYPOINT ["generator"]