diff --git a/.docker/Dockerfile b/.docker/Dockerfile index c59d9d5f2..7e0aac8f4 100644 --- a/.docker/Dockerfile +++ b/.docker/Dockerfile @@ -2,26 +2,9 @@ FROM golang:1.24-alpine AS builder RUN apk update && apk add --no-cache make bash nodejs npm -# Wallet-specific build configuration -# Default: / (for simple-stack deployment with direct port access) -ARG VITE_WALLET_BASE_PATH=/ -ARG VITE_EXPLORER_BASE_PATH=http://localhost:50001 -# RPC proxy targets for chain.json generation -ARG VITE_WALLET_RPC_PROXY_TARGET=http://localhost:50002 -ARG VITE_WALLET_ADMIN_RPC_PROXY_TARGET=http://localhost:50003 -ARG VITE_ROOT_WALLET_RPC_PROXY_TARGET=http://localhost:50002 - - WORKDIR /go/src/github.com/canopy-network/canopy COPY . /go/src/github.com/canopy-network/canopy -# Export build configuration to environment -ENV VITE_WALLET_BASE_PATH=${VITE_WALLET_BASE_PATH} -ENV VITE_EXPLORER_BASE_PATH=${VITE_EXPLORER_BASE_PATH} -ENV VITE_WALLET_RPC_PROXY_TARGET=${VITE_WALLET_RPC_PROXY_TARGET} -ENV VITE_WALLET_ADMIN_RPC_PROXY_TARGET=${VITE_WALLET_ADMIN_RPC_PROXY_TARGET} -ENV VITE_ROOT_WALLET_RPC_PROXY_TARGET=${VITE_ROOT_WALLET_RPC_PROXY_TARGET} - RUN make build/wallet RUN make build/explorer diff --git a/.docker/auto-update/Dockerfile b/.docker/auto-update/Dockerfile new file mode 100644 index 000000000..54ef37a28 --- /dev/null +++ b/.docker/auto-update/Dockerfile @@ -0,0 +1,62 @@ +FROM node:24-alpine AS builder + +ARG BRANCH='latest' +ARG CLI_DIR +ARG BUILD_PATH=cmd/cli +ARG GO_BIN_DIR +ARG BUILD_LOCAL=False +ARG BIN_PATH=/bin/cli + +# downloads git and clones selected version +RUN apk add --no-cache git ca-certificates alpine-sdk +WORKDIR /go/src/github.com/canopy-network/canopy +RUN echo "Building from BRANCH=${BRANCH}" && \ + if [ "$BRANCH" = "latest" ]; then \ + echo "Fetching latest tag..."; \ + git clone https://github.com/canopy-network/canopy.git . && \ + LATEST_TAG=$(git describe --tags `git rev-list --tags --max-count=1`) && \ + echo "Checking out tag $LATEST_TAG" && \ + git checkout $LATEST_TAG; \ + else \ + echo "Cloning branch $BRANCH" && \ + git clone -b "$BRANCH" https://github.com/canopy-network/canopy.git .; \ + fi +# copy golang +COPY --from=golang:1.24-alpine /usr/local/go/ /usr/local/go/ +ENV PATH="/usr/local/go/bin:${PATH}" + +RUN go version +# Builds +RUN apk update && apk add --no-cache make bash nodejs npm +RUN make build/wallet +RUN make build/explorer + +# Builds auto-update CLI +RUN CGO_ENABLED=0 GOOS=linux go build -a -o bin ./cmd/auto-update/. + +# Only build if the file at ${BIN_PATH} doesn't already exist +RUN if [ ! -f "${BIN_PATH}" ]; then \ + echo "File ${BIN_PATH} not found. Building it..."; \ + CGO_ENABLED=0 GOOS=linux go build -a -o "${BIN_PATH}" ./cmd/main/...; \ + else \ + echo "File ${BIN_PATH} already exists. Skipping build."; \ + fi + +FROM alpine:3.23 +WORKDIR /app +ARG BIN_PATH=/bin/cli + +# Coying for command +COPY --from=builder /go/src/github.com/canopy-network/canopy/bin ./canopy +# Copying cli for auto update +COPY --from=builder ${BIN_PATH} ${BIN_PATH} +# Copying entrypoint for persisting update cli +COPY entrypoint.sh /app/entrypoint.sh + +RUN apk add --no-cache pigz ca-certificates + +RUN chmod +x ${BIN_PATH} +RUN chmod +x /app/canopy +RUN chmod +x /app/entrypoint.sh + +ENTRYPOINT ["/app/entrypoint.sh"] diff --git a/.docker/auto-update/Dockerfile.csharp b/.docker/auto-update/Dockerfile.csharp new file mode 100644 index 000000000..213435e03 --- /dev/null +++ b/.docker/auto-update/Dockerfile.csharp @@ -0,0 +1,82 @@ +FROM node:24-alpine AS builder + +ARG BRANCH='latest' +ARG BIN_PATH=/bin/cli + +# Install build dependencies +RUN apk add --no-cache git ca-certificates alpine-sdk + +WORKDIR /go/src/github.com/canopy-network/canopy + +# Clone repository +RUN echo "Building from BRANCH=${BRANCH}" && \ + if [ "$BRANCH" = "latest" ]; then \ + echo "Fetching latest tag..."; \ + git clone https://github.com/canopy-network/canopy.git . && \ + LATEST_TAG=$(git describe --tags `git rev-list --tags --max-count=1`) && \ + echo "Checking out tag $LATEST_TAG" && \ + git checkout $LATEST_TAG; \ + else \ + echo "Cloning branch $BRANCH" && \ + git clone -b "$BRANCH" https://github.com/canopy-network/canopy.git .; \ + fi + +# Copy golang +COPY --from=golang:1.24-alpine /usr/local/go/ /usr/local/go/ +ENV PATH="/usr/local/go/bin:${PATH}" + +RUN go version + +# Install build tools +RUN apk update && apk add --no-cache make bash nodejs npm + +# Build wallet and explorer +RUN make build/wallet +RUN make build/explorer + +# Build auto-update coordinator +RUN CGO_ENABLED=0 GOOS=linux go build -a -o bin ./cmd/auto-update/. + +# Build CLI +RUN CGO_ENABLED=0 GOOS=linux go build -a -o "${BIN_PATH}" ./cmd/main/... + +# ============================================================================= +# Final image for C# plugin +# ============================================================================= +# Using Alpine base since C# plugin is now self-contained (includes .NET runtime) +FROM alpine:3.23 +WORKDIR /app +ARG BIN_PATH=/bin/cli + +# Install runtime dependencies +# - bash: required for pluginctl.sh scripts +# - procps: provides pkill for plugin process cleanup +# - ca-certificates: for HTTPS requests to GitHub API +# - pigz: for fast tarball extraction +# - libstdc++, libgcc, icu-libs: required by .NET self-contained apps on Alpine +RUN apk add --no-cache bash procps ca-certificates pigz libstdc++ libgcc icu-libs + +# Copy auto-update coordinator binary +COPY --from=builder /go/src/github.com/canopy-network/canopy/bin ./canopy + +# Copy CLI binary +COPY --from=builder ${BIN_PATH} ${BIN_PATH} + +# Create plugin directory and copy only pluginctl.sh +# Self-contained plugin binary will be downloaded from upstream release and extracted on first start +RUN mkdir -p /app/plugin/csharp/bin +COPY --from=builder /go/src/github.com/canopy-network/canopy/plugin/csharp/pluginctl.sh /app/plugin/csharp/pluginctl.sh + +# Copy entrypoint +COPY entrypoint.sh /app/entrypoint.sh + +# Set permissions +RUN chmod +x ${BIN_PATH} && \ + chmod +x /app/canopy && \ + chmod +x /app/entrypoint.sh && \ + chmod +x /app/plugin/csharp/pluginctl.sh + +# Create plugin temp directory +RUN mkdir -p /tmp/plugin + +ENTRYPOINT ["/app/entrypoint.sh"] diff --git a/.docker/auto-update/Dockerfile.go b/.docker/auto-update/Dockerfile.go new file mode 100644 index 000000000..1184c0cd0 --- /dev/null +++ b/.docker/auto-update/Dockerfile.go @@ -0,0 +1,80 @@ +FROM node:24-alpine AS builder + +ARG BRANCH='latest' +ARG BIN_PATH=/bin/cli + +# Install build dependencies +RUN apk add --no-cache git ca-certificates alpine-sdk + +WORKDIR /go/src/github.com/canopy-network/canopy + +# Clone repository +RUN echo "Building from BRANCH=${BRANCH}" && \ + if [ "$BRANCH" = "latest" ]; then \ + echo "Fetching latest tag..."; \ + git clone https://github.com/canopy-network/canopy.git . && \ + LATEST_TAG=$(git describe --tags `git rev-list --tags --max-count=1`) && \ + echo "Checking out tag $LATEST_TAG" && \ + git checkout $LATEST_TAG; \ + else \ + echo "Cloning branch $BRANCH" && \ + git clone -b "$BRANCH" https://github.com/canopy-network/canopy.git .; \ + fi + +# Copy golang +COPY --from=golang:1.24-alpine /usr/local/go/ /usr/local/go/ +ENV PATH="/usr/local/go/bin:${PATH}" + +RUN go version + +# Install build tools +RUN apk update && apk add --no-cache make bash nodejs npm + +# Build wallet and explorer +RUN make build/wallet +RUN make build/explorer + +# Build auto-update coordinator +RUN CGO_ENABLED=0 GOOS=linux go build -a -o bin ./cmd/auto-update/. + +# Build CLI +RUN CGO_ENABLED=0 GOOS=linux go build -a -o "${BIN_PATH}" ./cmd/main/... + +# ============================================================================= +# Final image for Go plugin +# ============================================================================= +FROM alpine:3.23 +WORKDIR /app +ARG BIN_PATH=/bin/cli + +# Install runtime dependencies +# - bash: required for pluginctl.sh scripts +# - procps: provides pkill for plugin process cleanup +# - ca-certificates: for HTTPS requests to GitHub API +# - pigz: for fast tarball extraction +RUN apk add --no-cache bash procps ca-certificates pigz + +# Copy auto-update coordinator binary +COPY --from=builder /go/src/github.com/canopy-network/canopy/bin ./canopy + +# Copy CLI binary +COPY --from=builder ${BIN_PATH} ${BIN_PATH} + +# Create plugin directory and copy only pluginctl.sh +# Plugin binary will be downloaded from upstream release and extracted on first start +RUN mkdir -p /app/plugin/go +COPY --from=builder /go/src/github.com/canopy-network/canopy/plugin/go/pluginctl.sh /app/plugin/go/pluginctl.sh + +# Copy entrypoint +COPY entrypoint.sh /app/entrypoint.sh + +# Set permissions +RUN chmod +x ${BIN_PATH} && \ + chmod +x /app/canopy && \ + chmod +x /app/entrypoint.sh && \ + chmod +x /app/plugin/go/pluginctl.sh + +# Create plugin temp directory +RUN mkdir -p /tmp/plugin + +ENTRYPOINT ["/app/entrypoint.sh"] diff --git a/.docker/auto-update/Dockerfile.kotlin b/.docker/auto-update/Dockerfile.kotlin new file mode 100644 index 000000000..4c86b0596 --- /dev/null +++ b/.docker/auto-update/Dockerfile.kotlin @@ -0,0 +1,81 @@ +FROM node:24-alpine AS builder + +ARG BRANCH='latest' +ARG BIN_PATH=/bin/cli + +# Install build dependencies +RUN apk add --no-cache git ca-certificates alpine-sdk + +WORKDIR /go/src/github.com/canopy-network/canopy + +# Clone repository +RUN echo "Building from BRANCH=${BRANCH}" && \ + if [ "$BRANCH" = "latest" ]; then \ + echo "Fetching latest tag..."; \ + git clone https://github.com/canopy-network/canopy.git . && \ + LATEST_TAG=$(git describe --tags `git rev-list --tags --max-count=1`) && \ + echo "Checking out tag $LATEST_TAG" && \ + git checkout $LATEST_TAG; \ + else \ + echo "Cloning branch $BRANCH" && \ + git clone -b "$BRANCH" https://github.com/canopy-network/canopy.git .; \ + fi + +# Copy golang +COPY --from=golang:1.24-alpine /usr/local/go/ /usr/local/go/ +ENV PATH="/usr/local/go/bin:${PATH}" + +RUN go version + +# Install build tools +RUN apk update && apk add --no-cache make bash nodejs npm + +# Build wallet and explorer +RUN make build/wallet +RUN make build/explorer + +# Build auto-update coordinator +RUN CGO_ENABLED=0 GOOS=linux go build -a -o bin ./cmd/auto-update/. + +# Build CLI +RUN CGO_ENABLED=0 GOOS=linux go build -a -o "${BIN_PATH}" ./cmd/main/... + +# ============================================================================= +# Final image for Kotlin plugin +# ============================================================================= +FROM alpine:3.23 +WORKDIR /app +ARG BIN_PATH=/bin/cli + +# Install runtime dependencies +# - bash: required for pluginctl.sh scripts +# - openjdk21-jre: Java runtime for Kotlin plugin +# - procps: provides pkill for plugin process cleanup +# - ca-certificates: for HTTPS requests to GitHub API +# - pigz: for fast tarball extraction +RUN apk add --no-cache bash openjdk21-jre procps ca-certificates pigz + +# Copy auto-update coordinator binary +COPY --from=builder /go/src/github.com/canopy-network/canopy/bin ./canopy + +# Copy CLI binary +COPY --from=builder ${BIN_PATH} ${BIN_PATH} + +# Create plugin directory and copy only pluginctl.sh +# Plugin JAR will be downloaded from upstream release and extracted on first start +RUN mkdir -p /app/plugin/kotlin/build/libs +COPY --from=builder /go/src/github.com/canopy-network/canopy/plugin/kotlin/pluginctl.sh /app/plugin/kotlin/pluginctl.sh + +# Copy entrypoint +COPY entrypoint.sh /app/entrypoint.sh + +# Set permissions +RUN chmod +x ${BIN_PATH} && \ + chmod +x /app/canopy && \ + chmod +x /app/entrypoint.sh && \ + chmod +x /app/plugin/kotlin/pluginctl.sh + +# Create plugin temp directory +RUN mkdir -p /tmp/plugin + +ENTRYPOINT ["/app/entrypoint.sh"] diff --git a/.docker/auto-update/Dockerfile.python b/.docker/auto-update/Dockerfile.python new file mode 100644 index 000000000..184db9036 --- /dev/null +++ b/.docker/auto-update/Dockerfile.python @@ -0,0 +1,81 @@ +FROM node:24-alpine AS builder + +ARG BRANCH='latest' +ARG BIN_PATH=/bin/cli + +# Install build dependencies +RUN apk add --no-cache git ca-certificates alpine-sdk + +WORKDIR /go/src/github.com/canopy-network/canopy + +# Clone repository +RUN echo "Building from BRANCH=${BRANCH}" && \ + if [ "$BRANCH" = "latest" ]; then \ + echo "Fetching latest tag..."; \ + git clone https://github.com/canopy-network/canopy.git . && \ + LATEST_TAG=$(git describe --tags `git rev-list --tags --max-count=1`) && \ + echo "Checking out tag $LATEST_TAG" && \ + git checkout $LATEST_TAG; \ + else \ + echo "Cloning branch $BRANCH" && \ + git clone -b "$BRANCH" https://github.com/canopy-network/canopy.git .; \ + fi + +# Copy golang +COPY --from=golang:1.24-alpine /usr/local/go/ /usr/local/go/ +ENV PATH="/usr/local/go/bin:${PATH}" + +RUN go version + +# Install build tools +RUN apk update && apk add --no-cache make bash nodejs npm + +# Build wallet and explorer +RUN make build/wallet +RUN make build/explorer + +# Build auto-update coordinator +RUN CGO_ENABLED=0 GOOS=linux go build -a -o bin ./cmd/auto-update/. + +# Build CLI +RUN CGO_ENABLED=0 GOOS=linux go build -a -o "${BIN_PATH}" ./cmd/main/... + +# ============================================================================= +# Final image for Python plugin +# ============================================================================= +FROM alpine:3.23 +WORKDIR /app +ARG BIN_PATH=/bin/cli + +# Install runtime dependencies +# - bash: required for pluginctl.sh scripts +# - python3, py3-pip, py3-setuptools: Python runtime for plugin and venv creation +# - procps: provides pkill for plugin process cleanup +# - ca-certificates: for HTTPS requests to GitHub API +# - pigz: for fast tarball extraction +RUN apk add --no-cache bash python3 py3-pip py3-setuptools procps ca-certificates pigz + +# Copy auto-update coordinator binary +COPY --from=builder /go/src/github.com/canopy-network/canopy/bin ./canopy + +# Copy CLI binary +COPY --from=builder ${BIN_PATH} ${BIN_PATH} + +# Create plugin directory and copy only pluginctl.sh +# Plugin source will be downloaded from upstream release and extracted on first start +RUN mkdir -p /app/plugin/python +COPY --from=builder /go/src/github.com/canopy-network/canopy/plugin/python/pluginctl.sh /app/plugin/python/pluginctl.sh + +# Copy entrypoint +COPY entrypoint.sh /app/entrypoint.sh + +# Set permissions +RUN chmod +x ${BIN_PATH} && \ + chmod +x /app/canopy && \ + chmod +x /app/entrypoint.sh && \ + chmod +x /app/plugin/python/pluginctl.sh + +# Create plugin temp directory +RUN mkdir -p /tmp/plugin + +ENTRYPOINT ["/app/entrypoint.sh"] diff --git a/.docker/auto-update/Dockerfile.typescript b/.docker/auto-update/Dockerfile.typescript new file mode 100644 index 000000000..e5d8af95e --- /dev/null +++ b/.docker/auto-update/Dockerfile.typescript @@ -0,0 +1,81 @@ +FROM node:24-alpine AS builder + +ARG BRANCH='latest' +ARG BIN_PATH=/bin/cli + +# Install build dependencies +RUN apk add --no-cache git ca-certificates alpine-sdk + +WORKDIR /go/src/github.com/canopy-network/canopy + +# Clone repository +RUN echo "Building from BRANCH=${BRANCH}" && \ + if [ "$BRANCH" = "latest" ]; then \ + echo "Fetching latest tag..."; \ + git clone https://github.com/canopy-network/canopy.git . && \ + LATEST_TAG=$(git describe --tags `git rev-list --tags --max-count=1`) && \ + echo "Checking out tag $LATEST_TAG" && \ + git checkout $LATEST_TAG; \ + else \ + echo "Cloning branch $BRANCH" && \ + git clone -b "$BRANCH" https://github.com/canopy-network/canopy.git .; \ + fi + +# Copy golang +COPY --from=golang:1.24-alpine /usr/local/go/ /usr/local/go/ +ENV PATH="/usr/local/go/bin:${PATH}" + +RUN go version + +# Install build tools +RUN apk update && apk add --no-cache make bash nodejs npm + +# Build wallet and explorer +RUN make build/wallet +RUN make build/explorer + +# Build auto-update coordinator +RUN CGO_ENABLED=0 GOOS=linux go build -a -o bin ./cmd/auto-update/. + +# Build CLI +RUN CGO_ENABLED=0 GOOS=linux go build -a -o "${BIN_PATH}" ./cmd/main/... + +# ============================================================================= +# Final image for TypeScript plugin +# ============================================================================= +FROM node:24-alpine +WORKDIR /app +ARG BIN_PATH=/bin/cli + +# Install runtime dependencies +# - bash: required for pluginctl.sh scripts +# - procps: provides pkill for plugin process cleanup +# - ca-certificates: for HTTPS requests to GitHub API +# - pigz: for fast tarball extraction +RUN apk add --no-cache bash procps ca-certificates pigz + +# Copy auto-update coordinator binary +COPY --from=builder /go/src/github.com/canopy-network/canopy/bin ./canopy + +# Copy CLI binary +COPY --from=builder ${BIN_PATH} ${BIN_PATH} + +# Create plugin directory and copy only pluginctl.sh +# Plugin code will be downloaded from upstream release and extracted on first start +# The upstream tarball includes dist/ and node_modules/ +RUN mkdir -p /app/plugin/typescript +COPY --from=builder /go/src/github.com/canopy-network/canopy/plugin/typescript/pluginctl.sh /app/plugin/typescript/pluginctl.sh + +# Copy entrypoint +COPY entrypoint.sh /app/entrypoint.sh + +# Set permissions +RUN chmod +x ${BIN_PATH} && \ + chmod +x /app/canopy && \ + chmod +x /app/entrypoint.sh && \ + chmod +x /app/plugin/typescript/pluginctl.sh + +# Create plugin temp directory +RUN mkdir -p /tmp/plugin + +ENTRYPOINT ["/app/entrypoint.sh"] diff --git a/.docker/auto-update/entrypoint.sh b/.docker/auto-update/entrypoint.sh new file mode 100644 index 000000000..a99de21b5 --- /dev/null +++ b/.docker/auto-update/entrypoint.sh @@ -0,0 +1,21 @@ +#!/bin/sh + +# if BIN_PATH its defined we make a link to it from its volume to our system +if [ -z "${BIN_PATH}" ]; then + echo "BIN_PATH not provided using /bin/cli as default" + export BIN_PATH="/bin/cli" +else + echo "using existing BIN_PATH $BIN_PATH" +fi + +# Persisting current version +# Check if it exist +if [ -f "/root/.canopy/cli" ]; then + echo "Found existing persistent cli version" +else + echo "Persisting build version for current cli" + cp "$BIN_PATH" /root/.canopy/cli +fi +ln -sf /root/.canopy/cli "$BIN_PATH" + +exec /app/canopy "$@" diff --git a/.docker/compose.yaml b/.docker/compose.yaml index ee77a260a..fbef16baf 100644 --- a/.docker/compose.yaml +++ b/.docker/compose.yaml @@ -4,12 +4,6 @@ services: build: context: .. dockerfile: .docker/Dockerfile - args: - VITE_WALLET_BASE_PATH: / - VITE_EXPLORER_BASE_PATH: http://localhost:50001 - VITE_WALLET_RPC_PROXY_TARGET: http://localhost:50002 - VITE_WALLET_ADMIN_RPC_PROXY_TARGET: http://localhost:50003 - VITE_ROOT_WALLET_RPC_PROXY_TARGET: http://localhost:50002 ports: - 50000:50000 # Wallet - 50001:50001 # Explorer @@ -34,13 +28,6 @@ services: build: context: .. dockerfile: .docker/Dockerfile - args: - VITE_WALLET_BASE_PATH: / - VITE_EXPLORER_BASE_PATH: http://localhost:40001 - VITE_WALLET_RPC_PROXY_TARGET: http://localhost:40002 - VITE_WALLET_ADMIN_RPC_PROXY_TARGET: http://localhost:40003 - VITE_ROOT_WALLET_RPC_PROXY_TARGET: http://localhost:50002 - ports: - 40000:40000 # Wallet - 40001:40001 # Explorer diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index de4a785a4..7ac66f5c6 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -8,7 +8,6 @@ on: required: true permissions: - # required for GITHUB_TOKEN to create a release contents: write jobs: @@ -32,9 +31,7 @@ jobs: make build/wallet make build/explorer mkdir -p dist - # AMD64 build GOARCH=amd64 CGO_ENABLED=0 GOOS=linux go build -a -o dist/cli-linux-amd64 ./cmd/main/... - # ARM64 build GOARCH=arm64 CGO_ENABLED=0 GOOS=linux go build -a -o dist/cli-linux-arm64 ./cmd/main/... - name: Create GitHub release @@ -48,9 +45,205 @@ jobs: env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - - name: Dispatch to Docker release repo + docker-main: + name: Docker - Main + runs-on: ubuntu-latest + needs: release + + steps: + - name: Checkout code + uses: actions/checkout@v4 + with: + ref: ${{ github.ref }} + + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v3 + + - name: Log in to Docker Hub + uses: docker/login-action@v3 + with: + username: ${{ secrets.DOCKER_USERNAME }} + password: ${{ secrets.DOCKER_PASSWORD }} + + - name: Build and push + run: | + TAG=${{ github.event.inputs.tag }} + DOCKER_TAG=${TAG//+/-} + docker build \ + -t canopynetwork/canopy:${DOCKER_TAG} \ + -t canopynetwork/canopy:latest \ + --build-arg BRANCH=${TAG} \ + --build-arg BUILD_PATH=cmd/cli \ + ./.docker/auto-update/ + docker push canopynetwork/canopy:${DOCKER_TAG} + docker push canopynetwork/canopy:latest + + docker-go: + name: Docker - Go Plugin + runs-on: ubuntu-latest + needs: release + + steps: + - name: Checkout code + uses: actions/checkout@v4 + with: + ref: ${{ github.ref }} + + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v3 + + - name: Log in to Docker Hub + uses: docker/login-action@v3 + with: + username: ${{ secrets.DOCKER_USERNAME }} + password: ${{ secrets.DOCKER_PASSWORD }} + + - name: Build and push + run: | + TAG=${{ github.event.inputs.tag }} + DOCKER_TAG=${TAG//+/-} + docker build \ + -t canopynetwork/canopy:go-${DOCKER_TAG} \ + -t canopynetwork/canopy:go-latest \ + --build-arg BRANCH=${TAG} \ + --build-arg BUILD_PATH=cmd/cli \ + -f ./.docker/auto-update/Dockerfile.go \ + ./.docker/auto-update/ + docker push canopynetwork/canopy:go-${DOCKER_TAG} + docker push canopynetwork/canopy:go-latest + + docker-python: + name: Docker - Python Plugin + runs-on: ubuntu-latest + needs: release + + steps: + - name: Checkout code + uses: actions/checkout@v4 + with: + ref: ${{ github.ref }} + + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v3 + + - name: Log in to Docker Hub + uses: docker/login-action@v3 + with: + username: ${{ secrets.DOCKER_USERNAME }} + password: ${{ secrets.DOCKER_PASSWORD }} + + - name: Build and push + run: | + TAG=${{ github.event.inputs.tag }} + DOCKER_TAG=${TAG//+/-} + docker build \ + -t canopynetwork/canopy:python-${DOCKER_TAG} \ + -t canopynetwork/canopy:python-latest \ + --build-arg BRANCH=${TAG} \ + --build-arg BUILD_PATH=cmd/cli \ + -f ./.docker/auto-update/Dockerfile.python \ + ./.docker/auto-update/ + docker push canopynetwork/canopy:python-${DOCKER_TAG} + docker push canopynetwork/canopy:python-latest + + docker-typescript: + name: Docker - TypeScript Plugin + runs-on: ubuntu-latest + needs: release + + steps: + - name: Checkout code + uses: actions/checkout@v4 + with: + ref: ${{ github.ref }} + + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v3 + + - name: Log in to Docker Hub + uses: docker/login-action@v3 + with: + username: ${{ secrets.DOCKER_USERNAME }} + password: ${{ secrets.DOCKER_PASSWORD }} + + - name: Build and push + run: | + TAG=${{ github.event.inputs.tag }} + DOCKER_TAG=${TAG//+/-} + docker build \ + -t canopynetwork/canopy:typescript-${DOCKER_TAG} \ + -t canopynetwork/canopy:typescript-latest \ + --build-arg BRANCH=${TAG} \ + --build-arg BUILD_PATH=cmd/cli \ + -f ./.docker/auto-update/Dockerfile.typescript \ + ./.docker/auto-update/ + docker push canopynetwork/canopy:typescript-${DOCKER_TAG} + docker push canopynetwork/canopy:typescript-latest + + docker-kotlin: + name: Docker - Kotlin Plugin + runs-on: ubuntu-latest + needs: release + + steps: + - name: Checkout code + uses: actions/checkout@v4 + with: + ref: ${{ github.ref }} + + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v3 + + - name: Log in to Docker Hub + uses: docker/login-action@v3 + with: + username: ${{ secrets.DOCKER_USERNAME }} + password: ${{ secrets.DOCKER_PASSWORD }} + + - name: Build and push + run: | + TAG=${{ github.event.inputs.tag }} + DOCKER_TAG=${TAG//+/-} + docker build \ + -t canopynetwork/canopy:kotlin-${DOCKER_TAG} \ + -t canopynetwork/canopy:kotlin-latest \ + --build-arg BRANCH=${TAG} \ + --build-arg BUILD_PATH=cmd/cli \ + -f ./.docker/auto-update/Dockerfile.kotlin \ + ./.docker/auto-update/ + docker push canopynetwork/canopy:kotlin-${DOCKER_TAG} + docker push canopynetwork/canopy:kotlin-latest + + docker-csharp: + name: Docker - C# Plugin + runs-on: ubuntu-latest + needs: release + + steps: + - name: Checkout code + uses: actions/checkout@v4 + with: + ref: ${{ github.ref }} + + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v3 + + - name: Log in to Docker Hub + uses: docker/login-action@v3 + with: + username: ${{ secrets.DOCKER_USERNAME }} + password: ${{ secrets.DOCKER_PASSWORD }} + + - name: Build and push run: | - curl -X POST https://api.github.com/repos/canopy-network/deployments/dispatches \ - -H "Accept: application/vnd.github+json" \ - -H "Authorization: token ${{ secrets.DISPATCH_TOKEN }}" \ - -d '{"event_type":"docker-release","client_payload":{"tag":"${{ github.event.inputs.tag }}"}}' + TAG=${{ github.event.inputs.tag }} + DOCKER_TAG=${TAG//+/-} + docker build \ + -t canopynetwork/canopy:csharp-${DOCKER_TAG} \ + -t canopynetwork/canopy:csharp-latest \ + --build-arg BRANCH=${TAG} \ + --build-arg BUILD_PATH=cmd/cli \ + -f ./.docker/auto-update/Dockerfile.csharp \ + ./.docker/auto-update/ + docker push canopynetwork/canopy:csharp-${DOCKER_TAG} + docker push canopynetwork/canopy:csharp-latest diff --git a/Dockerfile b/Dockerfile index c19cc62d8..8e6924856 100644 --- a/Dockerfile +++ b/Dockerfile @@ -3,26 +3,10 @@ FROM golang:1.24-alpine AS builder RUN apk update && apk add --no-cache make bash nodejs npm ARG BIN_PATH -# Wallet-specific build configuration -# Default: /wallet/ (for monitoring-stack deployment with Traefik reverse proxy) -# Override with: docker build --build-arg VITE_WALLET_BASE_PATH=/ -ARG VITE_WALLET_BASE_PATH=/wallet/ -# RPC proxy targets for chain.json generation -# For monitoring-stack, these should be Traefik URLs -ARG VITE_WALLET_RPC_PROXY_TARGET=/wallet/rpc -ARG VITE_WALLET_ADMIN_RPC_PROXY_TARGET=/wallet/adminrpc -ARG VITE_ROOT_WALLET_RPC_PROXY_TARGET=/wallet/rootrpc WORKDIR /go/src/github.com/canopy-network/canopy COPY . /go/src/github.com/canopy-network/canopy -# Export build configuration to environment -# These are available during npm build for wallet and explorer -ENV VITE_WALLET_BASE_PATH=${VITE_WALLET_BASE_PATH} -ENV VITE_WALLET_RPC_PROXY_TARGET=${VITE_WALLET_RPC_PROXY_TARGET} -ENV VITE_WALLET_ADMIN_RPC_PROXY_TARGET=${VITE_WALLET_ADMIN_RPC_PROXY_TARGET} -ENV VITE_ROOT_WALLET_RPC_PROXY_TARGET=${VITE_ROOT_WALLET_RPC_PROXY_TARGET} - RUN make build/wallet RUN make build/explorer RUN CGO_ENABLED=0 GOOS=linux go build -a -o bin ./cmd/auto-update/. diff --git a/cmd/rpc/web/wallet/.env.example b/cmd/rpc/web/wallet/.env.example index 71dc36845..d6c65c656 100644 --- a/cmd/rpc/web/wallet/.env.example +++ b/cmd/rpc/web/wallet/.env.example @@ -1,14 +1,3 @@ -# Wallet Base Path Configuration -# This sets the base URL path for the wallet in production builds -# -# Examples: -# - For deployment at https://example.com/wallet/ use: VITE_WALLET_BASE_PATH=/wallet/ -# - For deployment at https://wallet.example.com/ use: VITE_WALLET_BASE_PATH=/ -# - For deployment at root domain use: VITE_WALLET_BASE_PATH=/ -# -# Default: /wallet/ -VITE_WALLET_BASE_PATH=/wallet/ - # RPC Proxy Targets (Development Server Only) # Used by Vite dev server proxy configuration VITE_WALLET_RPC_PROXY_TARGET=http://localhost:50002 diff --git a/cmd/rpc/web/wallet/CLAUDE.md b/cmd/rpc/web/wallet/CLAUDE.md index 86dc25ea9..0159485fe 100644 --- a/cmd/rpc/web/wallet/CLAUDE.md +++ b/cmd/rpc/web/wallet/CLAUDE.md @@ -113,7 +113,6 @@ import { useConfig } from '@/app/providers/ConfigProvider' VITE_WALLET_RPC_PROXY_TARGET # RPC base URL (default: http://localhost:50002) VITE_WALLET_ADMIN_RPC_PROXY_TARGET # Admin RPC URL (default: http://localhost:50003) VITE_ROOT_WALLET_RPC_PROXY_TARGET # Root chain RPC (default: same as RPC) -VITE_WALLET_BASE_PATH # Base path for routing (default: / in dev, /wallet/ in prod) ``` ## Coding Conventions diff --git a/cmd/rpc/web/wallet/vite.config.ts b/cmd/rpc/web/wallet/vite.config.ts index 7348f6c98..a714e5a5c 100644 --- a/cmd/rpc/web/wallet/vite.config.ts +++ b/cmd/rpc/web/wallet/vite.config.ts @@ -6,27 +6,8 @@ export default defineConfig(({ mode }) => { // Load env file based on `mode` in the current working directory. const env = loadEnv(mode, ".", ""); - // Determine base path based on environment - // Priority: VITE_WALLET_BASE_PATH env var > production default > development default - const getBasePath = () => { - // If explicitly set via environment variable, use it - if (env.VITE_WALLET_BASE_PATH) { - return env.VITE_WALLET_BASE_PATH; - } - // In development, use / for local dev - if (mode === "development") { - return "/"; - } - // In production, use /wallet/ because the app is served behind a reverse proxy - // at http://node1.localhost/wallet/ - // This ensures: - // 1. Assets are requested as /wallet/assets/... (Traefik strips /wallet, Go server gets /assets/...) - // 2. React Router basename is /wallet (matches browser URL) - return "/wallet/"; - }; - return { - base: getBasePath(), + base: "/", resolve: { dedupe: ["react", "react-dom"], extensions: [".ts", ".tsx", ".js", ".jsx", ".mjs", ".json"], diff --git a/plugin/csharp/Dockerfile b/plugin/csharp/Dockerfile index 240ecd36e..1012d685a 100644 --- a/plugin/csharp/Dockerfile +++ b/plugin/csharp/Dockerfile @@ -17,7 +17,7 @@ COPY plugin/csharp/ ./ RUN dotnet publish CanopyPlugin.csproj -c Release -r linux-musl-x64 --self-contained true -o /out # Stage 3: Runtime (Alpine-based, self-contained binary includes .NET runtime) -FROM alpine:3.19 +FROM alpine:3.23 WORKDIR /app # Install runtime dependencies