Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
57 changes: 57 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
name: Release

on:
release:
types: [published]
workflow_dispatch:

env:
REGISTRY: ghcr.io
IMAGE_NAME: ${{ github.repository }}
KANIKO_VERSION: gcr.io/kaniko-project/executor@sha256:9e69fd4330ec887829c780f5126dd80edc663df6def362cd22e79bcdf00ac53f

jobs:
build-and-push:
runs-on: ubuntu-latest
permissions:
contents: read
packages: write

strategy:
matrix:
binary: [proxy-client, proxy-server]

steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Extract metadata
id: meta
uses: docker/metadata-action@9ec57ed1fcdf50867830130cc04c4d1bb9de141d
with:
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}-${{ matrix.binary }}
tags: |
type=semver,pattern={{version}}
type=semver,pattern={{major}}.{{minor}}
type=sha

- name: Build and Push with Kaniko
run: |
mkdir -p /home/runner/.docker

echo '{"auths":{"${{ env.REGISTRY }}":{"auth":"'$(echo -n "${{ github.actor }}:${{ secrets.GITHUB_TOKEN }}" | base64)'"}}}'> /home/runner/.docker/config.json

docker run \
-v ${{ github.workspace }}:/workspace \
-v /home/runner/.docker/config.json:/kaniko/.docker/config.json \
${{ env.KANIKO_VERSION }} \
--context /workspace \
--dockerfile /workspace/Dockerfile \
--reproducible \
--cache=true \
--cache-repo ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}-cache \
--build-arg BINARY=${{ matrix.binary }} \
--destination ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}-${{ matrix.binary }}:${{ steps.meta.outputs.version }} \
${{ join(steps.meta.outputs.tags-csv | split(',') | map(format('--destination %s', @)), ' ') }}
11 changes: 11 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
FROM golang:1.24rc2-bullseye@sha256:236da40764c1bcf469fcaf6ca225ca881c3f06cbd1934e392d6e4af3484f6cac AS builder

ARG BINARY=proxy-client
WORKDIR /app
COPY ./ /app
RUN make build-${BINARY}

FROM gcr.io/distroless/cc-debian12:nonroot-6755e21ccd99ddead6edc8106ba03888cbeed41a
ARG BINARY
COPY --from=builder /app/build/${BINARY} /app
ENTRYPOINT [ "/app" ]
4 changes: 2 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -26,12 +26,12 @@ build: clean build-proxy-client build-proxy-server ## Build the proxy client and
.PHONY: build-proxy-client
build-proxy-client: ## Build the proxy client
@mkdir -p ./build
go build -trimpath -ldflags "-X github.com/flashbots/cvm-reverse-proxy/common.Version=${VERSION}" -v -o ./build/proxy-client cmd/proxy-client/main.go
go build -trimpath -ldflags "-s -w -buildid= -X github.com/flashbots/cvm-reverse-proxy/common.Version=${VERSION}" -v -o ./build/proxy-client cmd/proxy-client/main.go

.PHONY: build-proxy-server
build-proxy-server: ## Build the proxy server
@mkdir -p ./build
go build -trimpath -ldflags "-X github.com/flashbots/cvm-reverse-proxy/common.Version=${VERSION}" -v -o ./build/proxy-server cmd/proxy-server/main.go
go build -trimpath -ldflags "-s -w -buildid= -X github.com/flashbots/cvm-reverse-proxy/common.Version=${VERSION}" -v -o ./build/proxy-server cmd/proxy-server/main.go

##@ Test & Development

Expand Down