Skip to content

Commit

Permalink
Merge pull request #74 from ufoscout/multiple_build
Browse files Browse the repository at this point in the history
support multiple architectures
  • Loading branch information
ufoscout authored Apr 7, 2023
2 parents 2127a8e + 59bd47b commit 25313c7
Show file tree
Hide file tree
Showing 4 changed files with 43 additions and 19 deletions.
22 changes: 17 additions & 5 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,24 +13,36 @@ 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
- name: Setup Rust
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.name == 'x86_64'
run: |
mkdir -p target/artifacts
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.target }}/release/wait" "target/artifacts/wait_${{ matrix.arch.name }}"
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
files: target/artifacts/*
10 changes: 5 additions & 5 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
[package]
name = "wait"
version = "2.10.0"
version = "2.11.0"
authors = ["ufoscout <[email protected]>"]
edition = "2018"
edition = "2021"

[dependencies]
port_check = "0.1"
Expand Down
26 changes: 19 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down Expand Up @@ -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' ./...
Expand All @@ -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`
Expand Down

0 comments on commit 25313c7

Please sign in to comment.