You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
RUN wget http://nz2.archive.ubuntu.com/ubuntu/pool/main/o/openssl/libssl1.1_1.1.1f-1ubuntu2_amd64.deb
27
-
RUN dpkg -i libssl1.1_1.1.1f-1ubuntu2_amd64.deb
38
+
# libssl1.1 is not needed for newer versions
28
39
29
40
# Install rust.
30
41
RUN curl "https://sh.rustup.rs" -sfo rustup.sh && \
31
42
sh rustup.sh -y && \
32
43
rustup component add rustfmt clippy
33
44
34
45
# Install node / npm / yarn.
35
-
RUN curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.33.11/install.sh | bash
36
-
ENV NVM_DIR="${HOME}/.nvm"
37
-
RUN . $NVM_DIR/nvm.sh && \
38
-
nvm install ${NODE_VERSION} && \
39
-
nvm use ${NODE_VERSION} && \
40
-
nvm alias default node && \
41
-
npm install -g yarn && \
42
-
yarn add ts-mocha
43
-
44
-
# Install Solana tools.
45
-
RUN sh -c "$(curl -sSfL https://release.solana.com/v${SOLANA_CLI}/install)"
46
+
RUN curl -fsSL https://deb.nodesource.com/setup_${NODE_VERSION} | bash - \
47
+
&& apt-get install -y nodejs \
48
+
&& apt-get install -y npm \
49
+
&& npm install -g yarn ts-mocha typescript mocha
50
+
51
+
# Install Solana tools (x86_64 version).
52
+
RUN curl -sSfL https://github.com/solana-labs/solana/releases/download/v${SOLANA_CLI}/solana-release-x86_64-unknown-linux-gnu.tar.bz2 | tar -xjC /tmp && \
53
+
mv /tmp/solana-release/bin/* /usr/local/bin/ && \
54
+
rm -rf /tmp/solana-release
46
55
47
56
# Install anchor.
48
-
RUN cargo install --git https://github.com/coral-xyz/anchor avm --locked --force
49
-
RUN avm install ${ANCHOR_CLI} && avm use ${ANCHOR_CLI}
57
+
RUN cargo install --git https://github.com/coral-xyz/anchor --tag v${ANCHOR_CLI} anchor-cli --locked
58
+
59
+
# Switch to the non-root user for the remaining setup
60
+
USER $USERNAME
50
61
51
62
RUN solana-keygen new --no-bip39-passphrase
52
63
53
-
WORKDIR /workdir
54
-
#be sure to add `/root/.avm/bin` to your PATH to be able to run the installed binaries
Copy file name to clipboardExpand all lines: README.md
+42Lines changed: 42 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -55,6 +55,48 @@ cargo test
55
55
bash test-scripts/run-anchor-tests.sh
56
56
```
57
57
58
+
# Development (with devcontainer)
59
+
60
+
We've provided a devcontainer `Dockerfile` to help you spin up a dev environment with the correct versions of Rust, Solana, and Anchor for program development.
61
+
62
+
Build the container and tag it `drift-dev`:
63
+
```
64
+
cd .devcontainer && docker build -t drift-dev .
65
+
```
66
+
67
+
Open a shell to the container:
68
+
```
69
+
# Find the container ID first
70
+
docker ps
71
+
72
+
# Then exec into it
73
+
docker exec -it <CONTAINER_ID> /bin/bash
74
+
```
75
+
76
+
Alternatively use an extension provided by your IDE to make use of the dev container. For example on vscode/cursor:
77
+
78
+
```
79
+
1. Press Ctrl+Shift+P (or Cmd+Shift+P on Mac)
80
+
2. Type "Dev Containers: Reopen in Container"
81
+
3. Select it and wait for the container to build
82
+
4. The IDE terminal should be targeting the dev container now
83
+
```
84
+
85
+
Use the dev container as you would a local build environment:
0 commit comments