Skip to content

Commit dbbb519

Browse files
authored
refactor(docker): use minimal docker for image publish (#149)
* refactor(docker): use minimal docker for image publish * update readme to add dockerfile taken from #148 * add skipped dockerfile
1 parent 35fd1ea commit dbbb519

File tree

7 files changed

+48
-36
lines changed

7 files changed

+48
-36
lines changed

.github/workflows/rust.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,6 @@ jobs:
1616
- name: Check-out code
1717
uses: actions/checkout@v2
1818
- name: Build image
19-
run: docker build -t agent .
19+
run: docker build -f integration-tests/Dockerfile -t agent .
2020
- name: Run tests
2121
run: docker run -v $PWD:/agent agent ./tests.sh

Cargo.lock

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "pyth-agent"
3-
version = "2.12.0"
3+
version = "2.12.1"
44
edition = "2021"
55

66
[[bin]]

Dockerfile

Lines changed: 11 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,17 @@
1-
FROM python:3.10-slim-bullseye
1+
FROM rust:slim-bookworm as builder
22

3-
# Install Rust
4-
RUN apt update && apt install -y curl pkg-config libssl-dev build-essential
5-
RUN curl https://sh.rustup.rs -sSf | bash -s -- -y
6-
ENV PATH="/root/.cargo/bin:${PATH}"
7-
RUN rustup toolchain install nightly
8-
9-
# Install poetry
10-
RUN pip install poetry
11-
ENV PATH="${PATH}:/root/.local/bin"
12-
RUN poetry config virtualenvs.in-project true
13-
14-
# Install Solana Tool Suite
15-
RUN sh -c "$(curl -sSfL https://release.solana.com/v1.14.17/install)"
16-
ENV PATH="${PATH}:/root/.local/share/solana/install/active_release/bin"
3+
RUN apt update && apt install -y curl libssl-dev pkg-config && apt clean all
174

185
ADD . /agent
196
WORKDIR /agent
207

218
RUN cargo build --release
9+
10+
FROM debian:12-slim
11+
12+
RUN apt update && apt install -y libssl-dev && apt clean all
13+
14+
COPY --from=builder /agent/target/release/agent /agent/
15+
COPY --from=builder /agent/config/* /agent/config/
16+
17+
ENTRYPOINT ["/agent/agent"]

README.md

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,19 @@ through the `RUST_LOG` environment variable using the standard
3737
Pyth agent will print logs in plaintext in terminal and JSON format in non-terminal environments (e.g. when writing to a file).
3838

3939
## Run
40-
`cargo run --release -- --config <your_config.toml>` will build and run the agent in a single step.
40+
### From Source
41+
The preferred way to run Pyth Agent is by compiling from source. You can run the below command to build and run the agent in a single step.
42+
43+
```bash
44+
cargo run --release -- --config <your_config.toml>
45+
```
46+
47+
### Container
48+
For convenience, a minimal container image is also published to [ECR Public](https://gallery.ecr.aws/pyth-network/agent). An example command for running this container can be found below. Make sure to update the image version to the latest release of Pyth Agent.
49+
50+
```bash
51+
docker run -v /path/to/configdir:/config:z,ro public.ecr.aws/pyth-network/agent:v2.12.0-minimal
52+
```
4153

4254
## Publishing API
4355
A running agent will expose a WebSocket serving the JRPC publishing API documented [here](https://docs.pyth.network/documentation/publish-data/pyth-client-websocket-api). See `config/config.toml` for related settings.

agent.Dockerfile

Lines changed: 0 additions & 17 deletions
This file was deleted.

integration-tests/Dockerfile

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
FROM python:3.10-slim-bullseye
2+
3+
# Install Rust
4+
RUN apt update && apt install -y curl pkg-config libssl-dev build-essential
5+
RUN curl https://sh.rustup.rs -sSf | bash -s -- -y
6+
ENV PATH="/root/.cargo/bin:${PATH}"
7+
RUN rustup toolchain install nightly
8+
9+
# Install poetry
10+
RUN pip install poetry
11+
ENV PATH="${PATH}:/root/.local/bin"
12+
RUN poetry config virtualenvs.in-project true
13+
14+
# Install Solana Tool Suite
15+
RUN sh -c "$(curl -sSfL https://release.solana.com/v1.14.17/install)"
16+
ENV PATH="${PATH}:/root/.local/share/solana/install/active_release/bin"
17+
18+
ADD . /agent
19+
WORKDIR /agent
20+
21+
RUN cargo build --release

0 commit comments

Comments
 (0)