-
Notifications
You must be signed in to change notification settings - Fork 9
Expand file tree
/
Copy pathDockerfile.python
More file actions
80 lines (61 loc) · 2.53 KB
/
Dockerfile.python
File metadata and controls
80 lines (61 loc) · 2.53 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
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"]