Skip to content

Commit

Permalink
fix docker portable build (flashbots#282)
Browse files Browse the repository at this point in the history
  • Loading branch information
metachris authored Aug 31, 2022
1 parent 77c33ff commit 0cf3987
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 18 deletions.
1 change: 1 addition & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
.git
10 changes: 5 additions & 5 deletions .github/workflows/releaser.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -32,22 +32,22 @@ jobs:

- name: Build and push
uses: docker/build-push-action@v3
env:
VERSION: ${{ steps.vars.outputs.tag }}
with:
context: .
push: true
build-args: |
VERSION=${{ steps.vars.outputs.tag }}
tags: flashbots/mev-boost:latest,flashbots/mev-boost:${{ steps.vars.outputs.tag }}
platforms: linux/amd64,linux/arm64

- name: Build and push portable
uses: docker/build-push-action@v3
env:
VERSION: ${{ steps.vars.outputs.tag }}
CGO_CFLAGS: "O -D__BLST_PORTABLE__"
with:
context: .
push: true
build-args: |
VERSION=${{ steps.vars.outputs.tag }}
CGO_CFLAGS="-O -D__BLST_PORTABLE__"
tags: flashbots/mev-boost:latest-portable,flashbots/mev-boost:${{ steps.vars.outputs.tag }}-portable
platforms: linux/amd64,linux/arm64

Expand Down
7 changes: 4 additions & 3 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
# syntax=docker/dockerfile:1
FROM golang:1.18 as builder
ARG VERSION
ARG CGO_CFLAGS
WORKDIR /build
ADD . /build/
RUN --mount=type=cache,target=/root/.cache/go-build make build-for-docker
RUN --mount=type=cache,target=/root/.cache/go-build CGO_CFLAGS="$CGO_CFLAGS" GOOS=linux go build -ldflags "-X 'github.com/flashbots/mev-boost/config.Version=$VERSION'" -v -o mev-boost .

FROM alpine

RUN apk add --no-cache libgcc libstdc++ libc6-compat
RUN apk add --no-cache libstdc++ libc6-compat
WORKDIR /app
COPY --from=builder /etc/ssl/certs/ca-certificates.crt /etc/ssl/certs/
COPY --from=builder /build/mev-boost /app/mev-boost
Expand Down
18 changes: 8 additions & 10 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ build:

.PHONY: build-portable
build-portable:
CGO_CFLAGS=-"O -D__BLST_PORTABLE__" go build -ldflags "-X 'github.com/flashbots/mev-boost/config.Version=${VERSION}' -X 'github.com/flashbots/mev-boost/config.BuildTime=$(shell date)'" -v -o mev-boost .
CGO_CFLAGS="-O -D__BLST_PORTABLE__" go build -ldflags "-X 'github.com/flashbots/mev-boost/config.Version=${VERSION}' -X 'github.com/flashbots/mev-boost/config.BuildTime=$(shell date)'" -v -o mev-boost .

.PHONY: build-testcli
build-testcli:
Expand Down Expand Up @@ -55,17 +55,15 @@ cover-html:
run-mergemock-integration: build
./scripts/run_mergemock_integration.sh

.PHONY: build-for-docker
build-for-docker:
GOOS=linux go build -ldflags "-X 'github.com/flashbots/mev-boost/config.Version=${VERSION}' -X 'github.com/flashbots/mev-boost/config.BuildTime=$(shell date)'" -v -o mev-boost .

.PHONY: build-for-docker-portable
build-for-docker-portable:
CGO_CFLAGS=-"O -D__BLST_PORTABLE__" GOOS=linux go build -ldflags "-X 'github.com/flashbots/mev-boost/config.Version=${VERSION}' -X 'github.com/flashbots/mev-boost/config.BuildTime=$(shell date)'" -v -o mev-boost .

.PHONY: docker-image
docker-image:
DOCKER_BUILDKIT=1 docker build . -t mev-boost
DOCKER_BUILDKIT=1 docker build --build-arg VERSION=${VERSION} . -t mev-boost
docker tag mev-boost:latest ${DOCKER_REPO}:${VERSION}
docker tag mev-boost:latest ${DOCKER_REPO}:latest

.PHONY: docker-image-portable
docker-image-portable:
DOCKER_BUILDKIT=1 docker build --build-arg CGO_CFLAGS="-O -D__BLST_PORTABLE__" --build-arg VERSION=${VERSION} . -t mev-boost
docker tag mev-boost:latest ${DOCKER_REPO}:${VERSION}
docker tag mev-boost:latest ${DOCKER_REPO}:latest

Expand Down

0 comments on commit 0cf3987

Please sign in to comment.