-
Notifications
You must be signed in to change notification settings - Fork 109
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
63 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
name: Docker | ||
|
||
on: | ||
push: | ||
pull_request: | ||
branches: [ main ] | ||
|
||
env: | ||
SOLANA_VERSION: 1.6.19 | ||
|
||
jobs: | ||
build: | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- uses: actions/checkout@v2 | ||
- run: echo "BRANCH=$( echo ${GITHUB_REF##*/} )" >> $GITHUB_ENV | ||
- run: echo "DOCKER_TAG=${BRANCH}" >> $GITHUB_ENV | ||
- run: echo "DOCKER_IMAGE=$( echo ${GITHUB_REPOSITORY}:${DOCKER_TAG} )" >> $GITHUB_ENV | ||
- run: docker build -f docker/Dockerfile --build-arg SOLANA_VERSION=${{ env.SOLANA_VERSION }} --tag ${{ env.DOCKER_IMAGE }} . | ||
# publish to ghcr.io | ||
- run: echo "${{ secrets.GITHUB_TOKEN }}" | docker login ghcr.io -u ${{ github.actor }} --password-stdin | ||
- run: docker image tag ${DOCKER_IMAGE} ghcr.io/${DOCKER_IMAGE} | ||
- run: docker image push ghcr.io/${{ env.DOCKER_IMAGE }} | ||
if: startsWith( github.ref, 'refs/tags/' ) | ||
# publish to docker.io | ||
- run: echo "${{ secrets.DOCKER_IO_PASS }}" | docker login docker.io -u ${{ secrets.DOCKER_IO_USER }} --password-stdin | ||
- run: docker image tag ${DOCKER_IMAGE} docker.io/pythfoundation/pyth-client:${DOCKER_TAG} | ||
- run: docker image push docker.io/pythfoundation/pyth-client:${DOCKER_TAG} | ||
if: startsWith( github.ref, 'refs/tags/' ) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
ARG SOLANA_VERSION | ||
|
||
FROM solanalabs/solana:v${SOLANA_VERSION} | ||
|
||
RUN apt-get update | ||
RUN apt-get install -y cmake curl g++ git libzstd1 libzstd-dev zlib1g zlib1g-dev | ||
|
||
RUN useradd -m pyth | ||
USER pyth | ||
WORKDIR /home/pyth | ||
|
||
COPY --chown=pyth:pyth ${GITHUB_WORKSPACE} pyth-client/ | ||
|
||
RUN cd pyth-client && mkdir build && cd build && cmake .. && make && ctest | ||
|
||
RUN echo "\nexport PATH=\$PATH:$HOME/pyth-client/build" >> .bashrc | ||
|
||
# Install Rust | ||
RUN curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y --default-toolchain none | ||
|
||
# Link Solana location for makefile | ||
RUN mkdir solana && cp -a /usr/bin/sdk solana | ||
|
||
# Build the program | ||
RUN PATH=$PATH:$HOME/.cargo/bin && cd pyth-client/program && make | ||
|
||
# Print hash of the program | ||
RUN sha256sum -b pyth-client/target/oracle.so | ||
|
||
ENTRYPOINT [] | ||
CMD [] | ||
|