Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: docker CI performance & release builds #2659

Merged
merged 11 commits into from
Aug 22, 2024
Merged
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
17 changes: 15 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -428,6 +428,17 @@ jobs:
- name: Install sccache
uses: mozilla-actions/sccache-action@v0.0.5

- name: Prep
run: sudo apt-get install musl-tools -y

- name: Build iroh
run: cargo build --profile=dev-ci --all-features --bin iroh --target x86_64-unknown-linux-musl

- name: Prep bins
run: |
mkdir -p bins/linux/amd64
cp target/x86_64-unknown-linux-musl/dev-ci/iroh bins/linux/amd64/iroh

- name: Cleanup Docker
continue-on-error: true
run: |
Expand All @@ -445,12 +456,14 @@ jobs:
tags: n0computer/iroh-test:latest
target: iroh
platforms: linux/amd64
file: docker/Dockerfile
file: docker/Dockerfile.ci

- name: Run Docker image & stats test
run: |
docker run -p 9090:9090 -p 4919:4919/udp -Pd n0computer/iroh-test:latest --rpc-addr 0.0.0.0:4919 start
cargo run --bin iroh -- --rpc-addr 127.0.0.1:4919 stats
# Give the server time to start
sleep 3
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I predict a future flake :(

Not sure what you can do better though, try to connect to the rpc addr in a loop with a short sleep and overall timeout of 30s? your connect would have to fail quickly in an identifiable way for that to work though.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If this gets flakey we probably should deal with it asap as a 3 sec startup is really not good.
Also the "old" setup just relied on cargo run to take it's sweet time compiling.

target/x86_64-unknown-linux-musl/dev-ci/iroh --rpc-addr 127.0.0.1:4919 stats

codespell:
runs-on: ubuntu-latest
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/docker.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ jobs:
uses: docker/build-push-action@v6
with:
context: .
push: true
push: ${{ github.event.inputs.publish }}
tags: n0computer/iroh:latest,n0computer/iroh:${{ github.event.inputs.release_version }}
target: iroh
platforms: linux/amd64,linux/arm64/v8
Expand All @@ -98,7 +98,7 @@ jobs:
uses: docker/build-push-action@v6
with:
context: .
push: true
push: ${{ github.event.inputs.publish }}
tags: n0computer/iroh-relay:latest,n0computer/iroh-relay:${{ github.event.inputs.release_version }}
target: iroh-relay
platforms: linux/amd64,linux/arm64/v8
Expand All @@ -108,7 +108,7 @@ jobs:
uses: docker/build-push-action@v6
with:
context: .
push: true
push: ${{ github.event.inputs.publish }}
tags: n0computer/iroh-dns-server:latest,n0computer/iroh-dns-server:${{ github.event.inputs.release_version }}
target: iroh-dns-server
platforms: linux/amd64,linux/arm64/v8
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -267,6 +267,7 @@ jobs:
docker:
needs: build_release
uses: './.github/workflows/docker.yaml'
secrets: inherit
with:
release_version: ${{ needs.build_release.outputs.release_version }}
base_hash: ${{ needs.build_release.outputs.base_hash }}
Expand Down
4 changes: 4 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,10 @@ resolver = "2"
[profile.release]
debug = true

[profile.dev-ci]
inherits = 'dev'
opt-level = 1

[profile.optimized-release]
inherits = 'release'
debug = false
Expand Down
8 changes: 4 additions & 4 deletions docker/Dockerfile.ci
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
### Base image for iroh-relay and iroh-dns-server
FROM alpine:latest as base
FROM alpine:latest AS base
RUN apk update && apk add ca-certificates && update-ca-certificates


### Target image
FROM base as iroh
FROM base AS iroh
ARG TARGETPLATFORM

COPY bins/${TARGETPLATFORM}/iroh /iroh
Expand All @@ -20,7 +20,7 @@ ENTRYPOINT ["/iroh"]
CMD ["start"]

### Target image
FROM base as iroh-relay
FROM base AS iroh-relay
ARG TARGETPLATFORM

COPY bins/${TARGETPLATFORM}/iroh-relay /iroh-relay
Expand All @@ -36,7 +36,7 @@ ENTRYPOINT ["/iroh-relay"]
CMD [""]

### Target image
FROM base as iroh-dns-server
FROM base AS iroh-dns-server
ARG TARGETPLATFORM

COPY bins/${TARGETPLATFORM}/iroh-dns-server /iroh-dns-server
Expand Down
Loading