Skip to content

Commit 9fa27eb

Browse files
committed
Merge branch 'release/1.3.1'
2 parents 93f4461 + 55cc974 commit 9fa27eb

17 files changed

Lines changed: 394 additions & 259 deletions

File tree

.cargo/config.toml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
[target.aarch64-unknown-linux-musl]
2+
linker = "aarch64-linux-gnu-gcc"

.dockerignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
/target

.github/workflows/release.yml

Lines changed: 37 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -8,53 +8,77 @@ jobs:
88
test:
99
name: Test
1010
runs-on: ubuntu-20.04
11+
strategy:
12+
matrix:
13+
target:
14+
- x86_64-unknown-linux-musl
15+
- aarch64-unknown-linux-musl
1116
steps:
1217
- uses: actions/checkout@v2
1318
- run: sudo apt-get install -y musl-tools busybox-static
19+
- run: sudo apt-get install -y gcc-aarch64-linux-gnu
20+
if: matrix.target == 'aarch64-unknown-linux-musl'
21+
- run: rustup target add ${{ matrix.target }}
1422
- uses: actions/cache@v2
1523
with:
1624
path: |
1725
target/
1826
~/.cargo/git/db/
1927
~/.cargo/registry/cache/
2028
~/.cargo/registry/index/
21-
key: "${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}"
29+
key: "${{ runner.os }}-cargo-${{ matrix.target }}-${{ hashFiles('**/Cargo.lock') }}"
2230
- uses: actions-rs/cargo@v1
2331
with:
2432
command: build
25-
args: --release --all-features --target=x86_64-unknown-linux-musl
33+
args: --release --all-features --target=${{ matrix.target }}
34+
- uses: actions/upload-artifact@v2
35+
with:
36+
name: musl-executable-${{ matrix.target }}
37+
path: ./target/${{ matrix.target }}/release/magicpak
2638
- uses: actions-rs/cargo@v1
2739
with:
2840
command: test
29-
args: --release --all-features --target=x86_64-unknown-linux-musl
30-
- uses: actions/upload-artifact@v2
31-
with:
32-
name: musl-executable
33-
path: ./target/x86_64-unknown-linux-musl/release/magicpak
41+
args: --release --all-features --target=${{ matrix.target }}
42+
if: matrix.target == 'x86_64-unknown-linux-musl' # TODO: test aarch64
3443
build_docker_images:
3544
name: Build and push docker images
3645
runs-on: ubuntu-20.04
3746
needs: test
3847
steps:
48+
- name: Free up disk space
49+
run: sudo rm -rf /usr/share/dotnet /usr/local/lib/android
3950
- uses: actions/checkout@v2
4051
- uses: actions/download-artifact@v2
4152
with:
42-
name: musl-executable
53+
name: musl-executable-x86_64-unknown-linux-musl
54+
- run: mkdir -p dist/amd64 && mv ./magicpak ./dist/amd64/magicpak
55+
- uses: actions/download-artifact@v2
56+
with:
57+
name: musl-executable-aarch64-unknown-linux-musl
58+
- run: mkdir -p dist/arm64 && mv ./magicpak ./dist/arm64/magicpak
59+
- uses: docker/setup-qemu-action@v2
60+
with:
61+
platforms: arm64
4362
- run: docker login -u ${{ secrets.DOCKER_HUB_USERNAME }} -p ${{ secrets.DOCKER_HUB_PASSWORD }}
4463
- uses: docker/setup-buildx-action@v1
45-
- run: ./dockerfile/build.sh ./magicpak
64+
- run: docker buildx bake --push --set '*.cache-from=type=gha' --set '*.cache-to=type=gha,mode=max'
4665
env:
47-
PUSH_IMAGES: true
48-
DOCKER_BUILD: "docker buildx build --load --cache-from type=gha --cache-to type=gha,mode=max"
66+
BIN_DIR: "./dist"
67+
VERSION: "1.3.1"
4968
release:
5069
name: Release
5170
runs-on: ubuntu-20.04
5271
needs: build_docker_images
72+
strategy:
73+
matrix:
74+
target:
75+
- x86_64-unknown-linux-musl
76+
- aarch64-unknown-linux-musl
5377
steps:
5478
- uses: actions/download-artifact@v2
5579
with:
56-
name: musl-executable
57-
- run: mv magicpak magicpak-x86_64-unknown-linux-musl
80+
name: musl-executable-${{ matrix.target }}
81+
- run: mv magicpak magicpak-${{ matrix.target }}
5882
- uses: softprops/action-gh-release@v1
5983
with:
6084
files: magicpak-*

.github/workflows/test.yml

Lines changed: 16 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -8,31 +8,36 @@ jobs:
88
runs-on: ubuntu-20.04
99
strategy:
1010
matrix:
11-
target: [x86_64-unknown-linux-musl]
11+
target:
12+
- x86_64-unknown-linux-musl
13+
- aarch64-unknown-linux-musl
1214
steps:
1315
- uses: actions/checkout@v2
1416
- run: sudo apt-get install -y musl-tools busybox-static
17+
- run: sudo apt-get install -y gcc-aarch64-linux-gnu
18+
if: matrix.target == 'aarch64-unknown-linux-musl'
19+
- run: rustup target add ${{ matrix.target }}
1520
- uses: actions/cache@v2
1621
with:
1722
path: |
1823
target/
1924
~/.cargo/git/db/
2025
~/.cargo/registry/cache/
2126
~/.cargo/registry/index/
22-
key: "${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}"
27+
key: "${{ runner.os }}-cargo-${{ matrix.target }}-${{ hashFiles('**/Cargo.lock') }}"
2328
- uses: actions-rs/cargo@v1
2429
with:
2530
command: build
2631
args: --release --all-features --target=${{ matrix.target }}
2732
- uses: actions/upload-artifact@v2
2833
with:
29-
name: musl-executable
30-
path: ./target/x86_64-unknown-linux-musl/release/magicpak
31-
if: matrix.target == 'x86_64-unknown-linux-musl'
34+
name: musl-executable-${{ matrix.target }}
35+
path: ./target/${{ matrix.target }}/release/magicpak
3236
- uses: actions-rs/cargo@v1
3337
with:
3438
command: test
3539
args: --release --all-features --target=${{ matrix.target }}
40+
if: matrix.target == 'x86_64-unknown-linux-musl' # TODO: test aarch64
3641
fmt:
3742
name: Rustfmt
3843
runs-on: ubuntu-20.04
@@ -59,19 +64,11 @@ jobs:
5964
- uses: actions/checkout@v2
6065
- uses: actions/download-artifact@v2
6166
with:
62-
name: musl-executable
67+
name: musl-executable-x86_64-unknown-linux-musl
68+
- run: mkdir -p dist/amd64 && mv ./magicpak ./dist/amd64/magicpak
6369
- uses: docker/setup-buildx-action@v1
64-
- name: Build docker images
65-
env:
66-
IMAGE_PREFIX: test-magicpak/
67-
PUSH_IMAGES: false
68-
DOCKER_BUILD: "docker buildx build --load --cache-from type=gha --cache-to type=gha,mode=max"
69-
run: |
70-
for example in ./example/*; do
71-
sed -e 's/FROM magicpak/FROM test-magicpak/' -i "$example/Dockerfile"
72-
grep 'FROM magicpak' "$example/Dockerfile" && exit 1 || true
73-
IMAGE=$(head -1 "$example/Dockerfile" | sed -e 's/FROM \(.*\)/\1/')
74-
IMAGE_FILTER=$IMAGE ./dockerfile/build.sh ./magicpak
75-
done
7670
- name: Build examples
77-
run: for example in ./example/*; do docker build "$example"; done
71+
run: docker buildx bake --set '*.cache-from=type=gha' --set '*.cache-to=type=gha,mode=max' --set 'base.platform=linux/amd64' example
72+
env:
73+
BIN_DIR: ./dist
74+
VERSION: 1.3.1

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,4 @@
11
/target
22
**/*.rs.bk
3+
4+
docker-bake.override.hcl

CHANGELOG.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,11 @@
22

33
All notable changes to this project will be documented in this file.
44

5+
## [1.3.1] - 2022-06-19
6+
7+
- AArch64 support ([#14](https://github.com/coord-e/magicpak/pull/14))
8+
- Use docker buildx bake to build container images ([#15](https://github.com/coord-e/magicpak/pull/15))
9+
510
## [1.3.0] - 2022-01-11
611

712
- Fix busybox_jail_path file permissions ([#6](https://github.com/coord-e/magicpak/pull/6))

Cargo.lock

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "magicpak"
3-
version = "1.3.0"
3+
version = "1.3.1"
44
authors = ["coord_e <me@coord-e.com>"]
55
edition = "2021"
66
license = "MIT OR Apache-2.0"
Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,22 @@
11
ARG BASE_IMAGE
22
FROM ${BASE_IMAGE}
33

4-
ARG DEBIAN_PACKAGES
4+
ARG APT_PACKAGES
55
RUN DEBIAN_FRONTEND=noninteractive \
66
apt-get update -y \
7-
&& apt-get install -y --no-install-recommends gcc libc-dev xz-utils busybox-static ${DEBIAN_PACKAGES} \
7+
&& apt-get install -y --no-install-recommends gcc libc-dev xz-utils busybox-static ${APT_PACKAGES} \
88
&& apt-get clean \
99
&& rm -rf /var/lib/apt/lists/*
1010

1111
ARG UPX_VERSION
12-
ARG MAGICPAK_PATH
12+
ARG MAGICPAK_DIR
13+
ARG TARGETARCH
1314

1415
ADD https://github.com/upx/upx/releases/download/v${UPX_VERSION}/upx-${UPX_VERSION}-amd64_linux.tar.xz /tmp/upx.tar.xz
1516
RUN cd /tmp \
1617
&& tar --strip-components=1 -xf upx.tar.xz \
1718
&& mv upx /bin/ \
1819
&& rm upx.tar.xz
1920

20-
COPY ${MAGICPAK_PATH} /bin/magicpak
21+
COPY $MAGICPAK_DIR/$TARGETARCH/magicpak /bin/magicpak
2122
RUN chmod +x /bin/magicpak

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
```dockerfile
1010
# You prepare /bin/your_executable here...
1111

12-
ADD https://github.com/coord-e/magicpak/releases/download/v1.3.0/magicpak-x86_64-unknown-linux-musl /usr/bin/magicpak
12+
ADD https://github.com/coord-e/magicpak/releases/download/v1.3.1/magicpak-x86_64-unknown-linux-musl /usr/bin/magicpak
1313
RUN chmod +x /usr/bin/magicpak
1414

1515
RUN /usr/bin/magicpak -v /bin/your_executable /bundle
@@ -94,7 +94,7 @@ We provide some base images that contain `magicpak` and its optional dependencie
9494
The following is a dockerfile using `magicpak` for a docker image of [`clang-format`](https://clang.llvm.org/docs/ClangFormat.html), a formatter for C/C++/etc. ([example/clang-format](/example/clang-format))
9595

9696
```dockerfile
97-
FROM magicpak/debian:buster-magicpak1.3.0
97+
FROM magicpak/debian:buster-magicpak1.3.1
9898

9999
RUN apt-get -y update
100100
RUN apt-get -y --no-install-recommends install clang-format

0 commit comments

Comments
 (0)