Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 17 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
.PHONY: help docker-prod testing-up testing-down

help: ## Show this help
@grep -E '^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | sort | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-15s\033[0m %s\n", $$1, $$2}'

docker-prod: ## Build production Docker image (dataplane:latest) from docker/Dockerfile
docker build -t dataplane:latest -f docker/Dockerfile .

testing-up: ## Launch testing stack: nginx, control plane, redis, postgres, pgbouncer, dataplane, fast_time_server
@docker image inspect dataplane:latest >/dev/null 2>&1 || { \
echo "Image dataplane:latest not found. Run 'make docker-prod' first."; \
exit 1; \
}
docker compose -f docker/docker-compose.yml up -d nginx control-plane redis postgres pgbouncer data-plane fast_time_server register_fast_time

testing-down: ## Tear down the testing stack
docker compose -f docker/docker-compose.yml stop nginx control-plane redis postgres pgbouncer data-plane fast_time_server register_fast_time
16 changes: 7 additions & 9 deletions docker/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,20 +1,18 @@
FROM rust:1.96.1 AS builder
WORKDIR /tmp/
WORKDIR /app

RUN <<EOF
apt update
apt install -y git ca-certificates protobuf-compiler
git config --global http.sslVerify false
git clone https://github.com/contextforge-gateway-rs/contextforge-gateway-rs
apt install -y ca-certificates protobuf-compiler
EOF
WORKDIR /tmp/contextforge-gateway-rs
COPY .cargo/config.toml ./.cargo/config.toml

COPY . .
RUN --mount=type=cache,id=cargo,target=/usr/local/cargo/registry \
--mount=type=cache,id=cargo-git,target=/usr/local/cargo/git \
cargo fetch --locked
RUN --mount=type=cache,id=cargo,target=/usr/local/cargo/registry \
--mount=type=cache,id=cargo-git,target=/usr/local/cargo/git \
cargo build --release
--mount=type=cache,id=cargo-git,target=/usr/local/cargo/git \
cargo build --release --features contextforge-gateway-rs-lib/with_tools

FROM debian:trixie-slim
RUN <<EOF
Expand All @@ -24,7 +22,7 @@ apt install -y python3
EOF

WORKDIR /
COPY --from=builder /tmp/contextforge-gateway-rs/target/release/contextforge-gateway-rs /contextforge-gateway-rs
COPY --from=builder /app/target/release/contextforge-gateway-rs /contextforge-gateway-rs
LABEL org.opencontainers.image.source=https://github.com/contextforge-gateway-rs/contextforge-gateway-rs
LABEL org.opencontainers.image.description="contextforge-gateway-rs - open source highly experimental dataplane for Contextforge Gateway."
ENTRYPOINT ["/contextforge-gateway-rs"]
Loading
Loading