diff --git a/.github/workflows/docker.yml b/.github/workflows/docker.yml new file mode 100644 index 00000000000..23dbacd2036 --- /dev/null +++ b/.github/workflows/docker.yml @@ -0,0 +1,50 @@ +name: "Push docker image to GCR" + +on: + push: + branches: [main] + paths: + - "packages/relayer/**" + +jobs: + push-docker-image: + name: Build and push docker image + runs-on: ubuntu-latest + + steps: + - name: Checkout + uses: actions/checkout@v2 + + - name: Login to GCR + uses: docker/login-action@v2 + with: + registry: gcr.io + username: _json_key + password: ${{ secrets.GCR_JSON_KEY }} + + - name: Set up QEMU + uses: docker/setup-qemu-action@v1 + + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v1 + + - name: Docker meta + id: meta + uses: docker/metadata-action@v4 + with: + images: | + gcr.io/evmchain/relayer + tags: | + type=ref,event=branch + type=ref,event=pr + type=ref,event=tag + type=sha + + - name: Build and push + uses: docker/build-push-action@v2 + with: + platforms: linux/amd64 + push: true + context: packages/relayer + tags: ${{ steps.meta.outputs.tags }} + labels: ${{ steps.meta.outputs.labels }} diff --git a/packages/relayer/Dockerfile b/packages/relayer/Dockerfile new file mode 100644 index 00000000000..67b8ab73d45 --- /dev/null +++ b/packages/relayer/Dockerfile @@ -0,0 +1,19 @@ +FROM golang:1.19.3 as builder + +RUN apt install git curl + +RUN git clone --depth 1 https://github.com/taikoxyz/taiko-mono /taiko-mono + +WORKDIR /taiko-mono/packages/relayer + +RUN go mod download + +RUN CGO_ENABLED=0 GOOS=linux go build -o ./bin/relayer cmd/main.go + +FROM alpine:latest + +RUN apk add --no-cache ca-certificates + +COPY --from=builder /taiko-mono/packages/relayer/bin/relayer /usr/local/bin/ + +ENTRYPOINT ["relayer"] \ No newline at end of file