-
Notifications
You must be signed in to change notification settings - Fork 15
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat : added docker build and updated docker compose (#141)
* feat : added docker build and updated docker compose * fixes * dockerfile * dockerfile * prettier * add on pt * remove from pr --------- Co-authored-by: Arun Jangra <[email protected]> Co-authored-by: byteZorvin <[email protected]>
- Loading branch information
1 parent
f65e11c
commit 86b8d9a
Showing
5 changed files
with
228 additions
and
8 deletions.
There are no files selected for viewing
This file contains 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,35 @@ | ||
# Ignore target directory | ||
target/ | ||
|
||
# Ignore version control files | ||
.git | ||
.gitignore | ||
|
||
# Ignore editor and IDE files | ||
.vscode/ | ||
.idea/ | ||
*.swp | ||
*.swo | ||
|
||
# Ignore log files | ||
*.log | ||
|
||
# TODO : uncomment this | ||
# Ignore any local environment files | ||
# .env | ||
# *.env | ||
|
||
# Ignore any test or documentation directories | ||
tests/ | ||
docs/ | ||
|
||
# Ignore Rust-specific files | ||
Cargo.lock | ||
|
||
# Ignore any temporary files | ||
*.tmp | ||
*.bak | ||
|
||
# Ignore OS-specific files | ||
.DS_Store | ||
Thumbs.db |
This file contains 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,52 @@ | ||
name: Build/Push Docker Image to ghcr | ||
|
||
on: | ||
workflow_dispatch: | ||
inputs: | ||
docker_tag: | ||
description: "Docker tag to use" | ||
required: true | ||
default: "latest" | ||
|
||
permissions: | ||
contents: read | ||
packages: write | ||
|
||
jobs: | ||
build_and_push: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v3 | ||
|
||
- name: Set up Docker Buildx | ||
uses: docker/setup-buildx-action@v2 | ||
with: | ||
driver: docker | ||
|
||
- name: Log in to GitHub Container Registry | ||
uses: docker/login-action@v2 | ||
with: | ||
registry: ghcr.io | ||
username: ${{ github.actor }} | ||
password: ${{ secrets.GITHUB_TOKEN }} | ||
|
||
- name: Set Docker image tag | ||
id: vars | ||
run: | | ||
if [ "${{ github.event_name }}" == "release" ]; then | ||
echo "TAG=${{ github.event.release.tag_name }}" >> $GITHUB_ENV | ||
elif [ "${{ github.event_name }}" == "workflow_dispatch" ]; then | ||
echo "TAG=${{ github.event.inputs.docker_tag }}" >> $GITHUB_ENV | ||
else | ||
echo "In case of manual trigger, docker tag must be present. Workflow failed." | ||
exit 1 | ||
fi | ||
- name: Build and push Docker image | ||
uses: docker/build-push-action@v4 | ||
with: | ||
context: . | ||
file: ./Dockerfile | ||
push: true | ||
tags: ghcr.io/${{ github.repository_owner }}/${{ github.event.repository.name }}:${{ env.TAG }} |
This file contains 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 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,74 @@ | ||
FROM rust:1.81 AS builder | ||
|
||
# Set the working directory in the container | ||
WORKDIR /usr/src/madara-orchestrator | ||
|
||
# Install system dependencies | ||
RUN apt update && apt install -y \ | ||
libgmp3-dev \ | ||
software-properties-common \ | ||
wget \ | ||
bash | ||
|
||
# Install Python 3.9 | ||
RUN wget https://www.python.org/ftp/python/3.9.16/Python-3.9.16.tgz \ | ||
&& tar xzf Python-3.9.16.tgz \ | ||
&& cd Python-3.9.16 \ | ||
&& ./configure --enable-optimizations \ | ||
&& make altinstall \ | ||
&& cd .. \ | ||
&& rm -rf Python-3.9.16 Python-3.9.16.tgz | ||
|
||
# Install pip | ||
RUN wget https://bootstrap.pypa.io/get-pip.py \ | ||
&& python3.9 get-pip.py \ | ||
&& rm get-pip.py | ||
|
||
# Set up Python environment and install Cairo | ||
RUN python3.9 -m venv /usr/local/cairo_venv | ||
RUN pip3.9 install ecdsa fastecdsa sympy | ||
RUN pip3.9 install cairo-lang | ||
|
||
RUN python3.9 --version && pip3.9 --version | ||
|
||
# Copy the current directory contents into the container | ||
COPY . . | ||
|
||
|
||
# Check rust version (this also installs version from rust-toolchain file) | ||
RUN rustup show | ||
|
||
# ############################################################# | ||
# TODO : remove this step after snos build is sorted | ||
# Build cairo lang | ||
RUN cargo fetch | ||
RUN bash -c "cd /usr/local/cargo/git/checkouts \ | ||
&& cd snos-* \ | ||
&& cd * \ | ||
&& source /usr/local/cairo_venv/bin/activate \ | ||
&& ./scripts/setup-tests.sh" | ||
# ############################################################# | ||
|
||
WORKDIR /usr/src/madara-orchestrator | ||
|
||
# Build the project | ||
RUN cargo build --release | ||
|
||
|
||
FROM debian:bookworm | ||
|
||
# Install runtime dependencies | ||
RUN apt-get -y update && \ | ||
apt-get install -y openssl ca-certificates &&\ | ||
apt-get autoremove -y; \ | ||
apt-get clean; \ | ||
rm -rf /var/lib/apt/lists/* | ||
|
||
# Set the working directory | ||
WORKDIR /usr/local/bin | ||
|
||
# Copy the compiled binary from the builder stage | ||
COPY --from=builder /usr/src/madara-orchestrator/target/release/orchestrator . | ||
|
||
# Set the entrypoint | ||
ENTRYPOINT ["./orchestrator"] |
This file contains 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 |
---|---|---|
@@ -1,16 +1,74 @@ | ||
services: | ||
app: | ||
build: . | ||
ports: | ||
- "${PORT}:3000" | ||
environment: | ||
- HOST=${HOST:-127.0.0.1} | ||
- PORT=${PORT:-3000} | ||
- AWS_ACCESS_KEY_ID=${AWS_ACCESS_KEY_ID} | ||
- AWS_SECRET_ACCESS_KEY=${AWS_SECRET_ACCESS_KEY} | ||
- AWS_REGION=${AWS_REGION:-us-east-1} | ||
- AWS_ENDPOINT_URL=${AWS_ENDPOINT_URL} | ||
- AWS_DEFAULT_REGION=${AWS_DEFAULT_REGION:-localhost} | ||
- DATA_STORAGE=${DATA_STORAGE:-s3} | ||
- AWS_S3_BUCKET_NAME=${AWS_S3_BUCKET_NAME} | ||
- QUEUE_PROVIDER=${QUEUE_PROVIDER:-sqs} | ||
- SQS_JOB_PROCESSING_QUEUE_URL=${SQS_JOB_PROCESSING_QUEUE_URL} | ||
- SQS_JOB_VERIFICATION_QUEUE_URL=${SQS_JOB_VERIFICATION_QUEUE_URL} | ||
- SQS_JOB_HANDLE_FAILURE_QUEUE_URL=${SQS_JOB_HANDLE_FAILURE_QUEUE_URL} | ||
- SQS_WORKER_TRIGGER_QUEUE_URL=${SQS_WORKER_TRIGGER_QUEUE_URL} | ||
- ALERTS=${ALERTS:-sns} | ||
- AWS_SNS_ARN=${AWS_SNS_ARN} | ||
- AWS_SNS_ARN_NAME=${AWS_SNS_ARN_NAME} | ||
- DATABASE=${DATABASE:-mongodb} | ||
- MONGODB_CONNECTION_STRING=${MONGODB_CONNECTION_STRING} | ||
- PROVER_SERVICE=${PROVER_SERVICE:-sharp} | ||
- SHARP_CUSTOMER_ID=${SHARP_CUSTOMER_ID} | ||
- SHARP_URL=${SHARP_URL} | ||
- SHARP_USER_CRT=${SHARP_USER_CRT} | ||
- SHARP_USER_KEY=${SHARP_USER_KEY} | ||
- SHARP_SERVER_CRT=${SHARP_SERVER_CRT} | ||
- SHARP_PROOF_LAYOUT=${SHARP_PROOF_LAYOUT:-small} | ||
- DA_LAYER=${DA_LAYER:-ethereum} | ||
- SETTLEMENT_LAYER=${SETTLEMENT_LAYER:-ethereum} | ||
- SETTLEMENT_RPC_URL=${SETTLEMENT_RPC_URL} | ||
- MADARA_RPC_URL=${MADARA_RPC_URL} | ||
- MEMORY_PAGES_CONTRACT_ADDRESS=${MEMORY_PAGES_CONTRACT_ADDRESS} | ||
- ETHEREUM_PRIVATE_KEY=${ETHEREUM_PRIVATE_KEY} | ||
- L1_CORE_CONTRACT_ADDRESS=${L1_CORE_CONTRACT_ADDRESS} | ||
- RPC_FOR_SNOS=${RPC_FOR_SNOS} | ||
- STARKNET_PRIVATE_KEY=${STARKNET_PRIVATE_KEY} | ||
- STARKNET_ACCOUNT_ADDRESS=${STARKNET_ACCOUNT_ADDRESS} | ||
- MADARA_BINARY_PATH=${MADARA_BINARY_PATH} | ||
- OTEL_SERVICE_NAME=${OTEL_SERVICE_NAME:-madara_orchestrator} | ||
- OTEL_COLLECTOR_ENDPOINT=${OTEL_COLLECTOR_ENDPOINT} | ||
- TRACING_LEVEL=${TRACING_LEVEL:-info} | ||
- STARKNET_OPERATOR_ADDRESS=${STARKNET_OPERATOR_ADDRESS} | ||
depends_on: | ||
- mongodb | ||
- localstack | ||
networks: | ||
- app-network | ||
|
||
mongodb: | ||
image: mongo:latest | ||
ports: | ||
- "27017:27017" | ||
networks: | ||
- app-network | ||
|
||
localstack: | ||
image: localstack/localstack | ||
container_name: localstack | ||
ports: | ||
- "4566:4566" | ||
environment: | ||
- DEFAULT_REGION=us-east-1 | ||
- AWS_ACCESS_KEY_ID=AWS_ACCESS_KEY_ID | ||
- AWS_SECRET_ACCESS_KEY=AWS_SECRET_ACCESS_KEY | ||
ports: | ||
- "4566:4566" | ||
networks: | ||
- app-network | ||
|
||
mongodb: | ||
image: mongo:latest | ||
container_name: mongodb | ||
ports: | ||
- "27017:27017" | ||
networks: | ||
app-network: | ||
driver: bridge |