mirror of
https://github.com/NexVeridian/ark-invest-api-rust.git
synced 2025-09-01 17:39:10 +00:00
1.1.0
This commit is contained in:
parent
3a34f6c1a3
commit
4306b99634
10 changed files with 105 additions and 41 deletions
9
.cargo/config.toml
Normal file
9
.cargo/config.toml
Normal file
|
@ -0,0 +1,9 @@
|
|||
[target.x86_64-unknown-linux-gnu]
|
||||
linker = "clang"
|
||||
rustflags = ["-C", "link-arg=-fuse-ld=/usr/bin/mold"]
|
||||
|
||||
[alias]
|
||||
t = "nextest run"
|
||||
|
||||
[build]
|
||||
target-dir = "target/target"
|
|
@ -1,9 +1,8 @@
|
|||
FROM mcr.microsoft.com/devcontainers/rust:bullseye
|
||||
# https://mcr.microsoft.com/en-us/product/devcontainers/rust/about
|
||||
FROM mcr.microsoft.com/devcontainers/rust:bookworm
|
||||
|
||||
RUN rustup target add x86_64-unknown-linux-musl && \
|
||||
apt-get update && \
|
||||
apt install -y build-essential xz-utils musl-tools musl-dev gcc-multilib && \
|
||||
rustup update
|
||||
RUN apt-get update && \
|
||||
apt install -y build-essential xz-utils musl-tools musl-dev gcc-multilib pkg-config libssl-dev clang mold
|
||||
|
||||
RUN LAZYGIT_VERSION=$(curl -s "https://api.github.com/repos/jesseduffield/lazygit/releases/latest" | grep -Po '"tag_name": "v\K[0-9.]+') && \
|
||||
curl -Lo lazygit.tar.gz "https://github.com/jesseduffield/lazygit/releases/latest/download/lazygit_${LAZYGIT_VERSION}_Linux_x86_64.tar.gz" && \
|
||||
|
@ -11,7 +10,10 @@ RUN LAZYGIT_VERSION=$(curl -s "https://api.github.com/repos/jesseduffield/lazygi
|
|||
rm -rf lazygit.tar.gz
|
||||
|
||||
RUN BTOP_VERSION=$(curl -s "https://api.github.com/repos/aristocratos/btop/releases/latest" | grep -Po '"tag_name": "v\K[0-9.]+') && \
|
||||
wget "https://github.com/aristocratos/btop/releases/download/${BTOP_VERSION}/btop-x86_64-linux-musl.tbz" && \
|
||||
wget "https://github.com/aristocratos/btop/releases/download/v${BTOP_VERSION}/btop-x86_64-linux-musl.tbz" && \
|
||||
sudo tar -xvf btop-x86_64-linux-musl.tbz && \
|
||||
cd btop && ./install.sh && cd .. && \
|
||||
rm -rf btop-x86_64-linux-musl.tbz btop
|
||||
|
||||
RUN curl -LsSf https://get.nexte.st/latest/linux | tar zxf - -C ${CARGO_HOME:-~/.cargo}/bin
|
||||
# cargo install cargo-nextest --locked
|
||||
|
|
|
@ -22,6 +22,11 @@
|
|||
"source": "devcontainer-cargo-cache-${containerWorkspaceFolderBasename}",
|
||||
"target": "/usr/local/cargo",
|
||||
"type": "volume"
|
||||
},
|
||||
{
|
||||
"source": "${localWorkspaceFolderBasename}-target",
|
||||
"target": "${containerWorkspaceFolder}/target",
|
||||
"type": "volume"
|
||||
}
|
||||
],
|
||||
// Features to add to the dev container. More info: https://containers.dev/features.
|
||||
|
@ -29,8 +34,8 @@
|
|||
"ghcr.io/devcontainers/features/git:1": {}
|
||||
// "ghcr.io/devcontainers/features/nix:1": {
|
||||
// "packages": [
|
||||
// "btop"
|
||||
// // "lazygit"
|
||||
// "btop",
|
||||
// "lazygit"
|
||||
// ]
|
||||
// }
|
||||
},
|
||||
|
@ -40,10 +45,11 @@
|
|||
// "postCreateCommand": {
|
||||
// },
|
||||
"postAttachCommand": {
|
||||
"AddGitSafeDir": "git config --global --add safe.directory /workspaces/${containerWorkspaceFolderBasename}"
|
||||
"AddGitSafeDir": "git config --global --add safe.directory /workspaces/${containerWorkspaceFolderBasename}",
|
||||
"update": "rustup target add x86_64-unknown-linux-musl && rustup update && cargo update",
|
||||
"clippy": "cargo clippy --fix --allow-dirty"
|
||||
},
|
||||
// Configure tool-specific properties.
|
||||
// "customizations": {},
|
||||
// Uncomment to connect as root instead. More info: https://aka.ms/dev-containers-non-root.
|
||||
"remoteUser": "root",
|
||||
"customizations": {
|
||||
|
@ -55,7 +61,6 @@
|
|||
"rust-lang.rust-analyzer",
|
||||
"mutantdino.resourcemonitor",
|
||||
"christian-kohler.path-intellisense",
|
||||
"Swellaby.vscode-rust-test-adapter",
|
||||
"Gruntfuggly.todo-tree",
|
||||
"ms-azuretools.vscode-docker",
|
||||
"redhat.vscode-yaml"
|
||||
|
|
|
@ -1,7 +1,8 @@
|
|||
.dockerignore
|
||||
/.devcontainer
|
||||
/.vscode
|
||||
/target
|
||||
.dockerignore
|
||||
Cargo.lock
|
||||
docker-compose.yml
|
||||
Dockerfile
|
||||
README.md
|
||||
docker-compose.yml
|
||||
*.md
|
||||
|
|
1
.gitignore
vendored
1
.gitignore
vendored
|
@ -24,7 +24,6 @@ wheels/
|
|||
.installed.cfg
|
||||
*.egg
|
||||
MANIFEST
|
||||
.vscode
|
||||
|
||||
# PyInstaller
|
||||
# Usually these files are written by a python script from a template
|
||||
|
|
43
.vscode/launch.json
vendored
Normal file
43
.vscode/launch.json
vendored
Normal file
|
@ -0,0 +1,43 @@
|
|||
{
|
||||
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
|
||||
"version": "0.2.0",
|
||||
"configurations": [
|
||||
{
|
||||
"type": "lldb",
|
||||
"request": "launch",
|
||||
"name": "Debug executable 'ark-invest-api-rust-data'",
|
||||
"cargo": {
|
||||
"args": [
|
||||
"build",
|
||||
"--bin=ark-invest-api-rust-data",
|
||||
"--package=ark-invest-api-rust-data"
|
||||
],
|
||||
"filter": {
|
||||
"name": "ark-invest-api-rust-data",
|
||||
"kind": "bin"
|
||||
}
|
||||
},
|
||||
"args": [],
|
||||
"cwd": "${workspaceFolder}"
|
||||
},
|
||||
{
|
||||
"type": "lldb",
|
||||
"request": "launch",
|
||||
"name": "Debug unit tests in executable 'ark-invest-api-rust-data'",
|
||||
"cargo": {
|
||||
"args": [
|
||||
"test",
|
||||
"--no-run",
|
||||
"--bin=ark-invest-api-rust-data",
|
||||
"--package=ark-invest-api-rust-data"
|
||||
],
|
||||
"filter": {
|
||||
"name": "ark-invest-api-rust-data",
|
||||
"kind": "bin"
|
||||
}
|
||||
},
|
||||
"args": [],
|
||||
"cwd": "${workspaceFolder}"
|
||||
}
|
||||
]
|
||||
}
|
17
.vscode/settings.json
vendored
Normal file
17
.vscode/settings.json
vendored
Normal file
|
@ -0,0 +1,17 @@
|
|||
{
|
||||
"[Rust]": {
|
||||
"editor.defaultFormatter": "rust-lang.rust-analyzer",
|
||||
"editor.formatOnSave": true,
|
||||
"editor.formatOnSaveMode": "file"
|
||||
},
|
||||
"rust-analyzer.check.command": "clippy",
|
||||
"rust-analyzer.cargo.buildScripts.overrideCommand": [
|
||||
"cargo",
|
||||
"clippy",
|
||||
"--fix",
|
||||
"--workspace",
|
||||
"--message-format=json",
|
||||
"--all-targets",
|
||||
"--allow-dirty"
|
||||
],
|
||||
}
|
15
Dockerfile
15
Dockerfile
|
@ -1,17 +1,24 @@
|
|||
FROM rust:latest AS builder
|
||||
FROM rust:bookworm AS builder
|
||||
|
||||
RUN rustup target add x86_64-unknown-linux-musl && apt update && apt install -y musl-tools musl-dev
|
||||
RUN apt-get update && \
|
||||
apt install -y musl-tools musl-dev libssl-dev clang mold
|
||||
|
||||
# RUN curl -LsSf https://get.nexte.st/latest/linux | tar zxf - -C ${CARGO_HOME:-~/.cargo}/bin
|
||||
RUN curl -LsSf https://get.nexte.st/latest/linux | tar zxf - -C /usr/local/bin
|
||||
# RUN cargo install cargo-nextest --locked
|
||||
|
||||
WORKDIR /ark-invest-api-rust
|
||||
|
||||
COPY . .
|
||||
|
||||
RUN rustup target add x86_64-unknown-linux-musl && rustup update && cargo update
|
||||
|
||||
RUN --mount=type=cache,target=/usr/local/cargo,from=rust,source=/usr/local/cargo \
|
||||
--mount=type=cache,target=./target \
|
||||
cargo build --target x86_64-unknown-linux-musl --release && \
|
||||
cp ./target/x86_64-unknown-linux-musl/release/ark-invest-api-rust .
|
||||
cp ./target/target/x86_64-unknown-linux-musl/release/ark-invest-api-rust .
|
||||
|
||||
FROM alpine:latest
|
||||
FROM alpine:latest AS main
|
||||
|
||||
WORKDIR /ark-invest-api-rust
|
||||
|
||||
|
|
21
README.md
21
README.md
|
@ -5,24 +5,7 @@ A REST API for ARK Invest holdings data, written in rust using [axum](https://gi
|
|||
Not affiliated with Ark Invest
|
||||
|
||||
# Install
|
||||
|
||||
Create docker-compose.yml
|
||||
```
|
||||
version: "3"
|
||||
services:
|
||||
ark-invest-api-rust:
|
||||
image: ghcr.io/nexveridian/ark-invest-api-rust:latest
|
||||
container_name: ark-invest-api-rust
|
||||
restart: unless-stopped
|
||||
volumes:
|
||||
- ./data:/ark-invest-api-rust/data
|
||||
ports:
|
||||
- "3000:3000"
|
||||
|
||||
volumes:
|
||||
data:
|
||||
```
|
||||
Recomended: add nginx-certbot to the docker-compose file, [GitHub](https://github.com/JonasAlfredsson/docker-nginx-certbot#run-with-docker-compose), [Docker Hub](https://hub.docker.com/r/jonasal/nginx-certbot)
|
||||
Copy docker-compose.yml
|
||||
|
||||
Create data folder next to docker-compose.yml, `data\parquet\*.parquet` with the ticker in all caps `ARKK.parquet`, get the data from [api.NexVeridian.com](https://api.NexVeridian.com) or [ark-invest-api-rust-data](https://github.com/NexVeridian/ark-invest-api-rust-data)
|
||||
|
||||
|
@ -50,8 +33,6 @@ Place data in `data\parquet\*.parquet` with the ticker in all caps `ARKK.parquet
|
|||
## Docker Compose
|
||||
`git clone`
|
||||
|
||||
Recomended: add nginx-certbot to the docker-compose file, [GitHub](https://github.com/JonasAlfredsson/docker-nginx-certbot#run-with-docker-compose), [Docker Hub](https://hub.docker.com/r/jonasal/nginx-certbot)
|
||||
|
||||
Place data in `data\parquet\*.parquet` with the ticker in all caps `ARKK.parquet`, get the data from [api.NexVeridian.com](https://api.NexVeridian.com) or [ark-invest-api-rust-data](https://github.com/NexVeridian/ark-invest-api-rust)
|
||||
|
||||
`docker compose build && docker compose up`
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
version: "3"
|
||||
services:
|
||||
ark-invest-api-rust:
|
||||
# image: ghcr.io/NexVeridian/ark-invest-api-rust:latest
|
||||
image: ark-invest-api-rust
|
||||
image: ghcr.io/NexVeridian/ark-invest-api-rust:latest
|
||||
# image: ark-invest-api-rust
|
||||
build:
|
||||
context: .
|
||||
args:
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue