Skip to content

Commit 417fa50

Browse files
ali-behjatiReisen
authored andcommitted
Add Dockerfile + CI release action
1 parent 02de296 commit 417fa50

File tree

2 files changed

+75
-0
lines changed

2 files changed

+75
-0
lines changed
Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
name: Build and Push Price Service Image
2+
on:
3+
push:
4+
tags:
5+
- hermes-v*
6+
workflow_dispatch:
7+
inputs:
8+
dispatch_description:
9+
description: "Dispatch description"
10+
required: true
11+
type: string
12+
permissions:
13+
contents: read
14+
id-token: write
15+
jobs:
16+
price-server-image:
17+
runs-on: ubuntu-latest
18+
steps:
19+
- uses: actions/checkout@v2
20+
- name: Set image tag to version of the git tag
21+
if: ${{ startsWith(github.ref, 'refs/tags/hermes-v') }}
22+
run: |
23+
PREFIX="refs/tags/hermes-"
24+
VERSION="${GITHUB_REF:${#PREFIX}}"
25+
echo "IMAGE_TAG=${VERSION}" >> "${GITHUB_ENV}"
26+
- name: Set image tag to the git commit hash
27+
if: ${{ !startsWith(github.ref, 'refs/tags/hermes-v') }}
28+
run: |
29+
echo "IMAGE_TAG=${{ github.sha }}" >> "${GITHUB_ENV}"
30+
- uses: aws-actions/configure-aws-credentials@8a84b07f2009032ade05a88a28750d733cc30db1
31+
with:
32+
role-to-assume: arn:aws:iam::192824654885:role/github-actions-ecr
33+
aws-region: eu-west-2
34+
- uses: docker/login-action@v2
35+
with:
36+
registry: public.ecr.aws
37+
env:
38+
AWS_REGION: us-east-1
39+
- run: |
40+
DOCKER_BUILDKIT=1 docker build -t $ECR_REGISTRY/$ECR_REPOSITORY:$IMAGE_TAG -f hermes/Dockerfile .
41+
docker push $ECR_REGISTRY/$ECR_REPOSITORY:$IMAGE_TAG
42+
env:
43+
ECR_REGISTRY: public.ecr.aws
44+
ECR_REPOSITORY: pyth-network/hermes

hermes/Dockerfile

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
FROM docker.io/golang:1.20.4@sha256:6dd5c5f8936d7d4487802fb10a77f31b1776740be0fc17ada1acb74ac958f7be AS build
2+
3+
# Install OS packages
4+
RUN apt-get update && apt-get install --yes \
5+
build-essential curl clang libssl-dev
6+
7+
# Install Rust
8+
RUN curl https://sh.rustup.rs -sSf | sh -s -- -y --quiet --no-modify-path
9+
ENV PATH="/root/.cargo/bin:${PATH}"
10+
11+
# Install Solana
12+
RUN sh -c "$(curl -sSfL https://release.solana.com/v1.14.17/install)"
13+
ENV PATH="/root/.local/share/solana/install/active_release/bin:$PATH"
14+
15+
# Set default toolchain
16+
RUN rustup default nightly-2023-01-15
17+
18+
# Build
19+
WORKDIR /src
20+
COPY hermes hermes
21+
COPY pythnet/pythnet_sdk pythnet/pythnet_sdk
22+
23+
24+
WORKDIR /src/hermes
25+
26+
RUN --mount=type=cache,target=/root/.cargo/registry cargo build --release
27+
28+
FROM docker.io/golang:1.20.4@sha256:6dd5c5f8936d7d4487802fb10a77f31b1776740be0fc17ada1acb74ac958f7be
29+
30+
# Copy artifacts from other images
31+
COPY --from=build /src/hermes/target/release/hermes /usr/local/bin/

0 commit comments

Comments
 (0)