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
2 changes: 0 additions & 2 deletions .dockerignore

This file was deleted.

71 changes: 71 additions & 0 deletions .github/workflows/eth2near-docker.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
name: Build and Push eth2near Docker Image

on:
push:
branches:
- master
- main
paths:
- 'eth2near/**'
- 'contracts/near/**'
- '.github/workflows/eth2near-docker.yml'
release:
types: [published]
workflow_dispatch:

env:
REGISTRY: europe-west4-docker.pkg.dev
PROJECT_ID: bridge-misc
REPOSITORY: omni-bridge-docker-images

jobs:
build-and-push:
runs-on: warp-ubuntu-latest-x64-8x
permissions:
contents: read
id-token: write

steps:
- name: Checkout repository
uses: actions/checkout@v5

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3

- name: Authenticate to Google Cloud
uses: google-github-actions/auth@v2
with:
credentials_json: ${{ secrets.GCP_SA_KEY }}

- name: Configure Docker to use gcloud as credential helper
run: gcloud auth configure-docker ${{ env.REGISTRY }}

- name: Extract metadata
id: meta
uses: docker/metadata-action@v5
with:
images: ${{ env.REGISTRY }}/${{ env.PROJECT_ID }}/${{ env.REPOSITORY }}/eth2near
tags: |
type=ref,event=branch
type=ref,event=pr
type=semver,pattern={{version}}
type=semver,pattern={{major}}.{{minor}}
type=semver,pattern={{major}}
type=sha,prefix={{branch}}
type=raw,value=latest,enable={{is_default_branch}}

- name: Build and push Docker image
id: build
uses: docker/build-push-action@v6
with:
context: .
file: ./eth2near/Dockerfile
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
platforms: linux/amd64
cache-from: type=gha
cache-to: type=gha,mode=max

- name: Output image digest
run: echo "Image pushed with digest ${{ steps.build.outputs.digest }}"
37 changes: 37 additions & 0 deletions eth2near/.dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
# Rust build artifacts
target/
**/*.rs.bk

# IDE files
.vscode/
.idea/
*.swp
*.swo

# OS files
.DS_Store
Thumbs.db

# Git
.git/
.gitignore

# Documentation
README.md
*.md

# Test files
tests/
**/*_test.rs

# Development files
.env
.env.local
.env.*.local

# Logs
*.log

# Temporary files
*.tmp
*.temp
34 changes: 34 additions & 0 deletions eth2near/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
# syntax=docker/dockerfile:1
FROM rust:1.84.0-bookworm AS builder

WORKDIR /app

# Copy everything
COPY contracts/ ./contracts/
COPY eth2near/ ./eth2near/

# Build with cache mounts
WORKDIR /app/eth2near
RUN --mount=type=cache,target=/usr/local/cargo/registry \
--mount=type=cache,target=/usr/local/cargo/git \
--mount=type=cache,target=/app/eth2near/target \
cargo build --release && \
cp target/release/eth2-contract-init /tmp/ && \
cp target/release/eth2_to_near_relay /tmp/

# === RUNTIME STAGE ===
FROM debian:bookworm-slim AS runtime

RUN apt-get update && apt-get install -y \
ca-certificates \
libssl3 \
&& rm -rf /var/lib/apt/lists/*

COPY --from=builder /tmp/eth2-contract-init /usr/local/bin/
COPY --from=builder /tmp/eth2_to_near_relay /usr/local/bin/

RUN useradd -m -u 1001 appuser
USER appuser
WORKDIR /app

CMD ["eth2_to_near_relay"]
Loading