Skip to content

Commit

Permalink
ci: Fix the Dockerfile and build from CI
Browse files Browse the repository at this point in the history
Fix the Dockerfile and add the Docker build to the CI.
The docker build error was:
```
1.359 E: Failed to fetch http://security.debian.org/debian-security/dists/stretch/updates/main/binary-amd64/Packages  404  Not Found
1.359 E: Failed to fetch http://deb.debian.org/debian/dists/stretch/main/binary-amd64/Packages  404  Not Found
1.359 E: Failed to fetch http://deb.debian.org/debian/dists/stretch-updates/main/binary-amd64/Packages  404  Not Found
1.359 E: Some index files failed to download. They have been ignored, or old ones used instead.
```

Also use a minimal image for the final build stage.
New image size is 240MB vs 4.4G for the old one.

In a follow up PR we could add multi-arch build support and automatic
image upload to Docker registries.
  • Loading branch information
AndreMiras committed Aug 27, 2024
1 parent 12a18d7 commit e7f4eec
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 8 deletions.
13 changes: 13 additions & 0 deletions .github/workflows/docker.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
name: Docker Build
on:
pull_request:
push:

jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: docker/setup-buildx-action@v3
- run: docker build --tag=canto-network/canto .
- run: docker run -it --volume --rm canto-network/canto
10 changes: 2 additions & 8 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,18 +1,12 @@
FROM golang:stretch AS build-env
FROM golang:1.21 AS build-env

WORKDIR /go/src/github.com/canto/canto

RUN apt-get update -y
RUN apt-get install git -y

COPY . .

RUN make build

FROM golang:stretch

RUN apt-get update -y
RUN apt-get install ca-certificates jq -y
FROM debian:12-slim

WORKDIR /root

Expand Down
5 changes: 5 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
# Becoming A Validator

[![Build Canto Core](https://github.com/Canto-Network/Canto/actions/workflows/build.yml/badge.svg)](https://github.com/Canto-Network/Canto/actions/workflows/build.yml)
[![Docker Build](https://github.com/Canto-Network/Canto/actions/workflows/docker.yml/badge.svg)](https://github.com/Canto-Network/Canto/actions/workflows/docker.yml)
[![Sims](https://github.com/Canto-Network/Canto/actions/workflows/sims.yml/badge.svg)](https://github.com/Canto-Network/Canto/actions/workflows/sims.yml)
[![Tests / Code Coverage](https://github.com/Canto-Network/Canto/actions/workflows/test.yml/badge.svg)](https://github.com/Canto-Network/Canto/actions/workflows/test.yml)

**How to validate on the Canto Mainnet**

*(canto_7700-1)*
Expand Down

0 comments on commit e7f4eec

Please sign in to comment.