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
28 changes: 19 additions & 9 deletions .github/workflows/upload-docker.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,9 @@ jobs:
- name: Log payload
run: echo "Received tag:\ ${{ github.event.client_payload.tag }}"

- name: Set up QEMU
uses: docker/setup-qemu-action@v3

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3

Expand All @@ -24,15 +27,22 @@ jobs:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}

- name: Build and push Docker image
- name: Prepare tags
id: prep
run: |
TAG=${{ github.event.client_payload.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_image/
docker push canopynetwork/canopy:${DOCKER_TAG}
docker push canopynetwork/canopy:latest
echo "docker_tag=${DOCKER_TAG}" >> $GITHUB_OUTPUT

- name: Build and push Docker image
uses: docker/build-push-action@v6
with:
context: ./docker_image/
platforms: linux/amd64,linux/arm64
push: true
tags: |
canopynetwork/canopy:${{ steps.prep.outputs.docker_tag }}
canopynetwork/canopy:latest
build-args: |
BRANCH=${{ github.event.client_payload.tag }}
BUILD_PATH=cmd/cli
10 changes: 10 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,16 @@ For more information please refer to [Monitoring stack README.md](./monitoring-s

It contains the [Dockerfile]([url](https://github.com/canopy-network/deployments/tree/master/docker_image)) and entrypoint.sh used by all the stacks in order to have a centralized way of building the canopy image

##### Multi-architecture support

The Docker image supports both `amd64` and `arm64` architectures. When building via the GitHub Actions workflow, images are automatically built for both platforms and published as a multi-arch manifest.

For multi-platform builds locally using Docker Buildx:

```bash
docker buildx build --platform linux/amd64,linux/arm64 -t canopynetwork/canopy:local ./docker_image/
```


#### Canopy config files

Expand Down
5 changes: 3 additions & 2 deletions docker_image/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ ARG BUILD_PATH=cmd/cli
ARG GO_BIN_DIR
ARG BUILD_LOCAL=False
ARG BIN_PATH=/bin/cli
ARG TARGETARCH

# downloads git and clones selected version
RUN apk add --no-cache git ca-certificates alpine-sdk
Expand All @@ -32,12 +33,12 @@ 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/.
RUN CGO_ENABLED=0 GOOS=linux GOARCH=${TARGETARCH} 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/...; \
CGO_ENABLED=0 GOOS=linux GOARCH=${TARGETARCH} go build -a -o "${BIN_PATH}" ./cmd/main/...; \
else \
echo "File ${BIN_PATH} already exists. Skipping build."; \
fi
Expand Down