Skip to content

Commit

Permalink
chore(relayer): Dockerfile + github action on merge to main (#316)
Browse files Browse the repository at this point in the history
  • Loading branch information
cyberhorsey authored Nov 23, 2022
1 parent 5f4723f commit 0052673
Show file tree
Hide file tree
Showing 2 changed files with 69 additions and 0 deletions.
50 changes: 50 additions & 0 deletions .github/workflows/docker.yml
Original file line number Diff line number Diff line change
@@ -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 }}
19 changes: 19 additions & 0 deletions packages/relayer/Dockerfile
Original file line number Diff line number Diff line change
@@ -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"]

0 comments on commit 0052673

Please sign in to comment.