-
Notifications
You must be signed in to change notification settings - Fork 23
feat: adding docker #258
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
feat: adding docker #258
Changes from all commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
5ed60b9
feat: adding docker
nahimterrazas 39938b9
feat: align
nahimterrazas 980554c
feat: docs
nahimterrazas 33b4d25
fix
nahimterrazas 8b54dc7
Merge branch 'main' into dockerfile
nahimterrazas 881c873
Enhance Dockerfile and README for improved configuration and KMS support
nahimterrazas 77a694e
Update Dockerfile and README for improved Redis configuration and Doc…
nahimterrazas 0b99e15
dockerignore
nahimterrazas File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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,45 @@ | ||
| # Build artifacts | ||
| target/ | ||
| *.rlib | ||
| *.rmeta | ||
|
|
||
| # IDE and editor files | ||
| .idea/ | ||
| .vscode/ | ||
| *.swp | ||
| *.swo | ||
| *~ | ||
|
|
||
| # Git | ||
| .git/ | ||
| .gitignore | ||
|
|
||
| # Documentation | ||
| *.md | ||
| !README.md | ||
| docs/ | ||
|
|
||
| # Test and demo files | ||
| .oif-demo/ | ||
| scripts/ | ||
|
|
||
| # Local configuration (mount at runtime instead) | ||
| config/*.local.toml | ||
|
|
||
| # Seed overrides (may contain secrets - mount at runtime instead) | ||
| config/seed-overrides*.json | ||
|
|
||
| # CI/CD | ||
| .github/ | ||
| .gitlab-ci.yml | ||
|
|
||
| # Docker | ||
| Dockerfile* | ||
| docker-compose* | ||
| .dockerignore | ||
|
|
||
| # Miscellaneous | ||
| *.log | ||
| *.tmp | ||
| .env* | ||
| .DS_Store | ||
This file contains hidden or 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 |
|---|---|---|
|
|
@@ -14,6 +14,7 @@ Thumbs.db | |
| # Environment | ||
| .env | ||
| .env.local | ||
| .env.docker | ||
|
|
||
| # Logs | ||
| *.log | ||
|
|
||
This file contains hidden or 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,65 @@ | ||
| # ------------------------------------------------------------------------------ | ||
| # Build environment | ||
| # ------------------------------------------------------------------------------ | ||
| # Rustc v1.86.0 | ||
| FROM cgr.dev/chainguard/rust:latest-dev@sha256:33faad9a26e8437ed9725bea3eb2d1e85facd1c035a31af8d485ea8c0a935532 AS builder | ||
|
tirumerla marked this conversation as resolved.
|
||
|
|
||
| # Optional features (e.g., "kms" for AWS KMS signer support) | ||
| ARG FEATURES="" | ||
|
|
||
| USER root | ||
| RUN apk update && apk --no-cache add \ | ||
| openssl-dev \ | ||
| perl | ||
|
|
||
| ENV PKG_CONFIG_PATH=/usr/lib/pkgconfig | ||
|
|
||
| WORKDIR /usr/app | ||
|
|
||
| # Copy source code | ||
| COPY . . | ||
|
|
||
| # Build with cargo cache mounts for faster rebuilds | ||
| # If FEATURES is set, add --features flag | ||
| RUN --mount=type=cache,target=/usr/local/cargo/registry \ | ||
| --mount=type=cache,target=/usr/local/cargo/git \ | ||
| --mount=type=cache,target=/usr/app/target \ | ||
| if [ -n "$FEATURES" ]; then \ | ||
| cargo install --root /usr/app --path crates/solver-service --features "$FEATURES" --locked; \ | ||
| else \ | ||
| cargo install --root /usr/app --path crates/solver-service --locked; \ | ||
| fi | ||
|
|
||
| # ------------------------------------------------------------------------------ | ||
| # Runtime environment | ||
| # ------------------------------------------------------------------------------ | ||
| FROM cgr.dev/chainguard/wolfi-base@sha256:417d791afa234c538bca977fe0f44011d2381e60a9fde44c938bd17b9cc38f66 | ||
|
|
||
| WORKDIR /app | ||
|
|
||
| # Copy the compiled binary | ||
| COPY --from=builder --chown=nonroot:nonroot /usr/app/bin/solver /app/solver | ||
|
|
||
| USER nonroot | ||
|
|
||
| # Expose the default API port | ||
| EXPOSE 3000 | ||
|
|
||
| # Set default environment variables | ||
| ENV RUST_LOG=info | ||
| ENV REDIS_URL=redis://localhost:6379 | ||
|
|
||
| # Configuration is seeded to Redis on first run, then loaded automatically. | ||
| # See config/example.env.docker for required environment variables. | ||
| # | ||
| # First run (seed configuration): | ||
| # docker run --env-file .env.docker -v $(pwd)/config:/app/config:ro oif-solver \ | ||
| # --seed testnet --seed-overrides /app/config/seed-overrides-testnet.json | ||
| # | ||
| # Subsequent runs (load from Redis): | ||
| # docker run --env-file .env.docker -e SOLVER_ID=your-solver-id oif-solver | ||
| # | ||
| # With KMS (build with: docker build --build-arg FEATURES=kms -t oif-solver .): | ||
| # docker run --env-file .env.docker -v $(pwd)/config:/app/config:ro oif-solver \ | ||
| # --seed testnet --seed-overrides /app/config/seed-overrides-kms.json | ||
| ENTRYPOINT ["/app/solver"] | ||
This file contains hidden or 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 hidden or 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,16 @@ | ||
| # Required | ||
| REDIS_URL=redis://host.docker.internal:6379 | ||
|
|
||
| # For local wallet (required unless using KMS) | ||
| SOLVER_PRIVATE_KEY=your-64-char-hex-private-key | ||
|
|
||
| # For subsequent runs (after seeding) | ||
| SOLVER_ID=my-solver | ||
|
|
||
| # Logging | ||
| RUST_LOG=info | ||
|
|
||
| # For KMS signer (build with: docker build --build-arg FEATURES=kms) | ||
| # AWS_ACCESS_KEY_ID=your-access-key | ||
| # AWS_SECRET_ACCESS_KEY=your-secret-key | ||
| # AWS_REGION=us-east-1 |
This file contains hidden or 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
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.