Skip to content

Commit

Permalink
Fix docker-bake issues with devops builds (#761)
Browse files Browse the repository at this point in the history
  • Loading branch information
pschork authored Sep 14, 2024
1 parent c17755a commit 7590049
Show file tree
Hide file tree
Showing 3 changed files with 44 additions and 17 deletions.
13 changes: 12 additions & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,13 @@ RUN --mount=type=cache,target=/go/pkg/mod \
--mount=type=cache,target=/root/.cache/go-build \
go build -o ./bin/apiserver ./cmd/apiserver

# DataAPI build stage
FROM common-builder AS dataapi-builder
WORKDIR /app/disperser
RUN --mount=type=cache,target=/go/pkg/mod \
--mount=type=cache,target=/root/.cache/go-build \
go build -o ./bin/dataapi ./cmd/dataapi

# Batcher build stage
FROM common-builder AS batcher-builder
WORKDIR /app/disperser
Expand Down Expand Up @@ -92,6 +99,10 @@ FROM alpine:3.18 AS apiserver
COPY --from=apiserver-builder /app/disperser/bin/apiserver /usr/local/bin
ENTRYPOINT ["apiserver"]

FROM alpine:3.18 AS dataapi
COPY --from=dataapi-builder /app/disperser/bin/dataapi /usr/local/bin
ENTRYPOINT ["dataapi"]

FROM alpine:3.18 AS batcher
COPY --from=batcher-builder /app/disperser/bin/batcher /usr/local/bin
ENTRYPOINT ["batcher"]
Expand All @@ -106,4 +117,4 @@ ENTRYPOINT ["node"]

FROM alpine:3.18 AS nodeplugin
COPY --from=node-plugin-builder /app/node/bin/nodeplugin /usr/local/bin
ENTRYPOINT ["nodeplugin"]
ENTRYPOINT ["nodeplugin"]
44 changes: 30 additions & 14 deletions docker-bake.hcl
Original file line number Diff line number Diff line change
@@ -1,10 +1,6 @@
# VARIABLES
variable "REGISTRY" {
default = "ghcr.io"
}

variable "REPOSITORY" {
default = "layr-labs/eigenda"
default = "ghcr.io/layr-labs/eigenda"
}

variable "BUILD_TAG" {
Expand Down Expand Up @@ -45,50 +41,69 @@ group "node-group-release" {
targets = ["node-release", "nodeplugin-release"]
}

# DOCKER METADATA TARGET
# See https://github.com/docker/metadata-action?tab=readme-ov-file#bake-definition

target "docker-metadata-action" {}

# DISPERSER TARGETS

target "batcher" {
inherits = ["docker-metadata-action"]
context = "."
dockerfile = "./Dockerfile"
target = "batcher"
tags = ["${REGISTRY}/${REPOSITORY}/batcher:${BUILD_TAG}"]
}

target "disperser" {
inherits = ["docker-metadata-action"]
context = "."
dockerfile = "./Dockerfile"
target = "apiserver"
tags = ["${REGISTRY}/${REPOSITORY}/disperser:${BUILD_TAG}"]
}

target "encoder" {
inherits = ["docker-metadata-action"]
context = "."
dockerfile = "./Dockerfile"
target = "encoder"
tags = ["${REGISTRY}/${REPOSITORY}/encoder:${BUILD_TAG}"]
}

target "retriever" {
inherits = ["docker-metadata-action"]
context = "."
dockerfile = "./Dockerfile"
target = "retriever"
tags = ["${REGISTRY}/${REPOSITORY}/retriever:${BUILD_TAG}"]
}

target "churner" {
inherits = ["docker-metadata-action"]
context = "."
dockerfile = "./Dockerfile"
target = "churner"
tags = ["${REGISTRY}/${REPOSITORY}/churner:${BUILD_TAG}"]
}

target "traffic-generator" {
inherits = ["docker-metadata-action"]
context = "."
dockerfile = "./trafficgenerator.Dockerfile"
target = "generator"
}

target "dataapi" {
inherits = ["docker-metadata-action"]
context = "."
dockerfile = "./Dockerfile"
target = "dataapi"
}

# NODE TARGETS

target "node" {
inherits = ["docker-metadata-action"]
context = "."
dockerfile = "./Dockerfile"
target = "node"
tags = ["${REGISTRY}/${REPOSITORY}/node:${BUILD_TAG}"]
args = {
SEMVER = "${SEMVER}"
GITCOMMIT = "${GITCOMMIT}"
Expand All @@ -97,10 +112,10 @@ target "node" {
}

target "nodeplugin" {
inherits = ["docker-metadata-action"]
context = "."
dockerfile = "./Dockerfile"
target = "nodeplugin"
tags = ["${REGISTRY}/${REPOSITORY}/nodeplugin:${BUILD_TAG}"]
}

# RELEASE TARGETS
Expand All @@ -111,10 +126,11 @@ target "_release" {

target "node-release" {
inherits = ["node", "_release"]
tags = ["${REGISTRY}/${REPOSITORY}/opr-node:${BUILD_TAG}"]
tags = ["${REGISTRY}/opr-node:${BUILD_TAG}"]
}

target "nodeplugin-release" {
inherits = ["nodeplugin", "_release"]
tags = ["${REGISTRY}/${REPOSITORY}/opr-nodeplugin:${BUILD_TAG}"]
tags = ["${REGISTRY}/opr-nodeplugin:${BUILD_TAG}"]
}

4 changes: 2 additions & 2 deletions trafficgenerator.Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@ RUN --mount=type=cache,target=/go/pkg/mod \
--mount=type=cache,target=/root/.cache/go-build \
go build -o ./bin/generator ./cmd

FROM alpine:3.18
FROM alpine:3.18 as generator

COPY --from=builder /app/tools/traffic/bin/generator /usr/local/bin

ENTRYPOINT ["generator"]
ENTRYPOINT ["generator"]

0 comments on commit 7590049

Please sign in to comment.