Skip to content
Open
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
11 changes: 5 additions & 6 deletions docker_image/entrypoint.sh
Original file line number Diff line number Diff line change
@@ -1,12 +1,11 @@
#!/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 "using existing BIN_PATH $BIN_PATH"
# if BIN_PATH it's no provided we sue '/bin/cli'
else
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
Expand All @@ -15,8 +14,8 @@ if [ -f "/root/.canopy/cli" ]; then
echo "Found existing persistent cli version"
else
echo "Persisting build version for current cli"
mv $BIN_PATH /root/.canopy/cli
cp $BIN_PATH /root/.canopy/cli
fi
ln -s /root/.canopy/cli $BIN_PATH
ln -sf /root/.canopy/cli $BIN_PATH

exec /app/canopy "$@"
81 changes: 81 additions & 0 deletions docker_image/plugins/Dockerfile.csharp
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
FROM node:18-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.19
WORKDIR /app

# 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/cli /bin/cli

# Create plugin directory and copy only pluginctl.sh
# Plugin DLL 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/cli && \
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"]
79 changes: 79 additions & 0 deletions docker_image/plugins/Dockerfile.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
FROM node:18-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.19
WORKDIR /app

# 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/cli /bin/cli

# 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/cli && \
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"]
80 changes: 80 additions & 0 deletions docker_image/plugins/Dockerfile.kotlin
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
FROM node:18-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.19
WORKDIR /app

# 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/cli /bin/cli

# 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/cli && \
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"]
80 changes: 80 additions & 0 deletions docker_image/plugins/Dockerfile.python
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
FROM node:18-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.19
WORKDIR /app

# 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/cli /bin/cli

# 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/cli && \
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"]
Loading