From 90bc4d9687ee47343ffce3adac5aea010a7eb26b Mon Sep 17 00:00:00 2001 From: Francesco Cina Date: Fri, 7 Apr 2023 15:06:37 +0200 Subject: [PATCH 1/3] multiple binary release --- .github/workflows/release.yml | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index ef4408b..4211d5e 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -14,7 +14,7 @@ jobs: matrix: arch: - "x86_64" - # - "aarch64" + - "aarch64" runs-on: ubuntu-latest steps: - uses: actions/checkout@v3 @@ -30,6 +30,15 @@ jobs: command: build args: --release --target=${{ matrix.arch }}-unknown-linux-musl use-cross: true + - name: Copy and prepare default artifact for release + run: | + mkdir target/artifacts + cp "target/x86_64-unknown-linux-musl/release/wait" "target/artifacts/wait" + - name: Copy and prepare all artifacts for release + run: | + cp "target/${{ matrix.arch }}-unknown-linux-musl/release/wait" "target/artifacts/wait_${{ matrix.arch }}" + echo "Artifacts list:" + ls -latr target/artifacts/* - name: Release uses: softprops/action-gh-release@v1 with: From 18fa29e5aef2adaa7eafe6ecb68a7406a8b5d888 Mon Sep 17 00:00:00 2001 From: Francesco Cina Date: Fri, 7 Apr 2023 15:13:43 +0200 Subject: [PATCH 2/3] Fix release script 1 --- .github/workflows/release.yml | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 4211d5e..0098564 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -31,15 +31,17 @@ jobs: args: --release --target=${{ matrix.arch }}-unknown-linux-musl use-cross: true - name: Copy and prepare default artifact for release + if: matrix.arch == 'x86_64' run: | - mkdir target/artifacts - cp "target/x86_64-unknown-linux-musl/release/wait" "target/artifacts/wait" + mkdir -p target/artifacts + cp "target/${{ matrix.arch }}-unknown-linux-musl/release/wait" "target/artifacts/wait" - name: Copy and prepare all artifacts for release run: | + mkdir -p target/artifacts cp "target/${{ matrix.arch }}-unknown-linux-musl/release/wait" "target/artifacts/wait_${{ matrix.arch }}" echo "Artifacts list:" ls -latr target/artifacts/* - name: Release uses: softprops/action-gh-release@v1 with: - files: target/${{ matrix.arch }}-unknown-linux-musl/release/wait \ No newline at end of file + files: target/artifacts/* \ No newline at end of file From 59bd47b287e4a456caa723a432f135d383633d3b Mon Sep 17 00:00:00 2001 From: Francesco Cina Date: Fri, 7 Apr 2023 15:46:45 +0200 Subject: [PATCH 3/3] Add arm7 prebuilt file --- .github/workflows/release.yml | 15 ++++++++------- Cargo.lock | 10 +++++----- Cargo.toml | 4 ++-- README.md | 26 +++++++++++++++++++------- 4 files changed, 34 insertions(+), 21 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 0098564..85cd82c 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -13,8 +13,9 @@ jobs: strategy: matrix: arch: - - "x86_64" - - "aarch64" + - { name: x86_64, target: x86_64-unknown-linux-musl } + - { name: aarch64, target: aarch64-unknown-linux-musl } + - { name: armv7, target: armv7-unknown-linux-musleabihf } runs-on: ubuntu-latest steps: - uses: actions/checkout@v3 @@ -22,23 +23,23 @@ jobs: uses: actions-rs/toolchain@v1 with: toolchain: stable - target: ${{ matrix.arch }}-unknown-linux-musl + target: ${{ matrix.arch.target }} override: true - name: Build uses: actions-rs/cargo@v1 with: command: build - args: --release --target=${{ matrix.arch }}-unknown-linux-musl + args: --release --target=${{ matrix.arch.target }} use-cross: true - name: Copy and prepare default artifact for release - if: matrix.arch == 'x86_64' + if: matrix.arch.name == 'x86_64' run: | mkdir -p target/artifacts - cp "target/${{ matrix.arch }}-unknown-linux-musl/release/wait" "target/artifacts/wait" + cp "target/${{ matrix.arch.target }}/release/wait" "target/artifacts/wait" - name: Copy and prepare all artifacts for release run: | mkdir -p target/artifacts - cp "target/${{ matrix.arch }}-unknown-linux-musl/release/wait" "target/artifacts/wait_${{ matrix.arch }}" + cp "target/${{ matrix.arch.target }}/release/wait" "target/artifacts/wait_${{ matrix.arch.name }}" echo "Artifacts list:" ls -latr target/artifacts/* - name: Release diff --git a/Cargo.lock b/Cargo.lock index dc4a58e..12dcd07 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -62,9 +62,9 @@ dependencies = [ [[package]] name = "getrandom" -version = "0.2.8" +version = "0.2.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c05aeb6a22b8f62540c194aac980f2115af067bfe15a0734d7277a768d396b31" +checksum = "c85e1d9ab2eadba7e5040d4e09cbd6d072b76a557ad64e797c2cb9d4da21d7e4" dependencies = [ "cfg-if", "libc", @@ -79,9 +79,9 @@ checksum = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646" [[package]] name = "libc" -version = "0.2.140" +version = "0.2.141" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "99227334921fae1a979cf0bfdfcc6b3e5ce376ef57e16fb6fb3ea2ed6095f80c" +checksum = "3304a64d199bb964be99741b7a14d26972741915b3649639149b2479bb46f4b5" [[package]] name = "log" @@ -142,7 +142,7 @@ checksum = "24188a676b6ae68c3b2cb3a01be17fbf7240ce009799bb56d5b1409051e78fde" [[package]] name = "wait" -version = "2.10.0" +version = "2.11.0" dependencies = [ "atomic-counter", "env_logger", diff --git a/Cargo.toml b/Cargo.toml index e7da300..6db3d1d 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,8 +1,8 @@ [package] name = "wait" -version = "2.10.0" +version = "2.11.0" authors = ["ufoscout "] -edition = "2018" +edition = "2021" [dependencies] port_check = "0.1" diff --git a/README.md b/README.md index 6488629..6736004 100644 --- a/README.md +++ b/README.md @@ -3,7 +3,7 @@ ![Build Status](https://github.com/ufoscout/docker-compose-wait/actions/workflows/build_and_test.yml/badge.svg) [![codecov](https://codecov.io/gh/ufoscout/docker-compose-wait/branch/master/graph/badge.svg)](https://codecov.io/gh/ufoscout/docker-compose-wait) -A small command-line utility to wait for other docker images to be started while using docker-compose. +A small command-line utility to wait for other docker images to be started while using docker-compose (or Kubernetes or docker stack or whatever). It permits waiting for: - a fixed amount of seconds @@ -21,7 +21,8 @@ For example, your application "MySuperApp" uses MongoDB, Postgres and MySql (wow FROM alpine ## Add the wait script to the image -ADD https://github.com/ufoscout/docker-compose-wait/releases/download/2.10.0/wait /wait +## This is the default executable for the x86_64 architecture, other architectures are supported too +ADD https://github.com/ufoscout/docker-compose-wait/releases/download/2.11.0/wait /wait RUN chmod +x /wait ## Add your application to the docker image @@ -81,7 +82,7 @@ When using [distroless](https://github.com/GoogleContainerTools/distroless) or b ```dockerfile FROM golang -RUN wget -o /wait https://github.com/ufoscout/docker-compose-wait/releases/download/2.10.0/wait +RUN wget -o /wait https://github.com/ufoscout/docker-compose-wait/releases/download/{{VERSION}}/wait COPY myApp /app WORKDIR /app RUN go build -o /myApp -ldflags '-s -w -extldflags -static' ./... @@ -107,16 +108,27 @@ The behaviour of the wait utility can be configured with the following environme - _WAIT_AFTER_: number of seconds to wait (sleep) once all the hosts/paths are available - _WAIT_SLEEP_INTERVAL_: number of seconds to sleep between retries. The default is 1 second. +## Supported architectures + +From release 2.11.0, the following executables are available for download: +- _wait_: This is the executable intended for Linux x64 systems +- *wait_x86_64*: This is the very same executable than _wait_ +- *wait_aarch64*: This is the executable to be used for aarch64 architectures +- *wait_arm7*: This is the executable to be used for arm7 architectures + +All executables are built with [MUSL](https://www.musl-libc.org/) for maximum portability. + +To use any of these executables, simply replace the executable name in the download link: +https://github.com/ufoscout/docker-compose-wait/releases/download/{{VERSION}}/{{executable_name}} + + ## Using on non-linux systems The simplest way of getting the _wait_ executable is to download it from [https://github.com/ufoscout/docker-compose-wait/releases/download/{{VERSION}}/wait](https://github.com/ufoscout/docker-compose-wait/releases/download/{{VERSION}}/wait) -This is a pre-built executable for Linux x64 systems which are the default ones in Docker. -In addition, it is built with [MUSL](https://www.musl-libc.org/) for maximum portability. - -If you need it for a different architecture, you should clone this repository and build it for your target. +If you need it for an architecture for which a pre-built file is not available, you should clone this repository and build it for your target. As it has no external dependencies, an being written in the mighty [rust](https://www.rust-lang.org) programming language, the build process is just a simple `cargo build --release`