Skip to content

Commit 18d0bf6

Browse files
committed
docker action
1 parent 91d6eb0 commit 18d0bf6

File tree

3 files changed

+63
-1
lines changed

3 files changed

+63
-1
lines changed

.github/workflows/docker.yaml

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
name: Docker
2+
3+
on:
4+
push:
5+
pull_request:
6+
branches: [ main ]
7+
8+
env:
9+
SOLANA_VERSION: 1.6.19
10+
11+
jobs:
12+
build:
13+
runs-on: ubuntu-latest
14+
15+
steps:
16+
- uses: actions/checkout@v2
17+
- run: echo "BRANCH=$( echo ${GITHUB_REF##*/} )" >> $GITHUB_ENV
18+
- run: echo "DOCKER_TAG=${BRANCH}" >> $GITHUB_ENV
19+
- run: echo "DOCKER_IMAGE=$( echo ${GITHUB_REPOSITORY}:${DOCKER_TAG} )" >> $GITHUB_ENV
20+
- run: docker build -f docker/Dockerfile --build-arg SOLANA_VERSION=${{ env.SOLANA_VERSION }} --tag ${{ env.DOCKER_IMAGE }} .
21+
# publish to ghcr.io
22+
- run: echo "${{ secrets.GITHUB_TOKEN }}" | docker login ghcr.io -u ${{ github.actor }} --password-stdin
23+
- run: docker image tag ${DOCKER_IMAGE} ghcr.io/${DOCKER_IMAGE}
24+
- run: docker image push ghcr.io/${{ env.DOCKER_IMAGE }}
25+
if: startsWith( github.ref, 'refs/tags/' )
26+
# publish to docker.io
27+
- run: echo "${{ secrets.DOCKER_IO_PASS }}" | docker login docker.io -u ${{ secrets.DOCKER_IO_USER }} --password-stdin
28+
- run: docker image tag ${DOCKER_IMAGE} docker.io/pythfoundation/pyth-client:${DOCKER_TAG}
29+
- run: docker image push docker.io/pythfoundation/pyth-client:${DOCKER_TAG}
30+
if: startsWith( github.ref, 'refs/tags/' )

CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
cmake_minimum_required( VERSION 3.16 )
1+
cmake_minimum_required( VERSION 3.13 )
22

33
# project pyth-client
44
project( pyth-client )

docker/Dockerfile

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
ARG SOLANA_VERSION
2+
3+
FROM solanalabs/solana:v${SOLANA_VERSION}
4+
5+
RUN apt-get update
6+
RUN apt-get install -y cmake curl g++ git libzstd1 libzstd-dev zlib1g zlib1g-dev
7+
8+
RUN useradd -m pyth
9+
USER pyth
10+
WORKDIR /home/pyth
11+
12+
COPY --chown=pyth:pyth ${GITHUB_WORKSPACE} pyth-client/
13+
14+
RUN cd pyth-client && mkdir build && cd build && cmake .. && make && ctest
15+
16+
RUN echo "\nexport PATH=\$PATH:$HOME/pyth-client/build" >> .bashrc
17+
18+
# Install Rust
19+
RUN curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y --default-toolchain none
20+
21+
# Link Solana location for makefile
22+
RUN mkdir solana && cp -a /usr/bin/sdk solana
23+
24+
# Build the program
25+
RUN PATH=$PATH:$HOME/.cargo/bin && cd pyth-client/program && make
26+
27+
# Print hash of the program
28+
RUN sha256sum -b pyth-client/target/oracle.so
29+
30+
ENTRYPOINT []
31+
CMD []
32+

0 commit comments

Comments
 (0)