diff --git a/.github/workflows/rainix-docker.yml b/.github/workflows/rainix-docker.yml new file mode 100644 index 0000000000..7a480e8f30 --- /dev/null +++ b/.github/workflows/rainix-docker.yml @@ -0,0 +1,51 @@ +name: Docker image CI + +on: + push: + workflow_dispatch: + inputs: + tag: + description: 'Tag to give the build. Try to make it unique.' + required: true + +env: + CHANNEL: ${{ inputs.tag || github.head_ref || github.ref_name }} + DOCKER_BUILDKIT: 1 + COMPOSE_DOCKER_CLI_BUILD: 1 + TAG_BASE: rainprotocol/pyth-crosschain + +jobs: + build: + runs-on: ubuntu-latest + permissions: + id-token: write + contents: write + steps: + - uses: actions/checkout@v4 + with: + submodules: recursive + fetch-depth: 0 + + - name: Install Nix 1/2 + uses: DeterminateSystems/nix-installer-action@main + with: + determinate: true + - name: Install Nix 2/2 + uses: DeterminateSystems/flakehub-cache-action@main + + - name: Install deps + run: nix develop -c pnpm install --frozen-lockfile + + - name: Build Price Pusher + run: nix develop -c pnpm turbo build --filter @pythnetwork/price-pusher + + - uses: docker/setup-buildx-action@v2 + - uses: docker/login-action@v2 + with: + username: ${{ secrets.DOCKERHUB_USERNAME }} + password: ${{ secrets.DOCKERHUB_TOKEN }} + - run: | + rm .dockerignore + docker build -t "$TAG_BASE:$CHANNEL" --build-arg GIT_SHA=${{ github.sha }} --build-arg DOCKER_CHANNEL=$CHANNEL . + - run: | + docker push "$TAG_BASE:$CHANNEL" diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000000..0483e0e1fb --- /dev/null +++ b/Dockerfile @@ -0,0 +1,21 @@ +FROM node:22.14 + +# set git sha and docker tag form build time arg to run time env in container +ARG GIT_SHA +ARG DOCKER_CHANNEL +ENV GIT_COMMIT=$GIT_SHA +ENV DOCKER_TAG=$DOCKER_CHANNEL + +WORKDIR /price-pusher +ADD . . + +WORKDIR apps/price_pusher +CMD ["bash", "-c", "npm run start evm -- \ + --price-config-file ./price-config.stable.sample.yaml \ + --endpoint \"${ENDPOINT}\" \ + --pyth-contract-address \"${PYTH_CONTRACT_ADDRESS}\" \ + --price-service-endpoint \"${PRICE_SERVICE_ENDPOINT}\" \ + --mnemonic-file <(echo \"${MNEMONIC}\") \ + --pushing-frequency \"${PUSHING_FREQUENCY:-300}\" \ + --polling-frequency \"${POLLING_FREQUENCY:-5}\" \ + --override-gas-price-multiplier \"${GAS_PRICE_MULTIPLIER:-1.1}\""]