Skip to content

Commit 34f9231

Browse files
mnitchevfals
authored andcommitted
build: adding static binaries and release for castai
1 parent 5afb4bc commit 34f9231

File tree

4 files changed

+88
-1
lines changed

4 files changed

+88
-1
lines changed

.github/workflows/release.yml

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
name: Publish GitHub Release
2+
3+
on:
4+
push:
5+
tags:
6+
- '*'
7+
workflow_dispatch:
8+
9+
permissions:
10+
packages: write
11+
contents: read
12+
13+
jobs:
14+
build-and-publish-kind-image:
15+
permissions:
16+
contents: write
17+
runs-on: ubuntu-latest
18+
steps:
19+
- name: Check out code
20+
uses: actions/checkout@v3
21+
22+
- name: Create multi architecture builder
23+
run: |
24+
docker buildx create --name multi-arch --platform "linux/arm64,linux/amd64" --driver "docker-container"
25+
docker buildx ls --no-trunc
26+
27+
- name: Build amd64 with Docker
28+
run: docker buildx build --builder multi-arch --platform linux/amd64 -f release/Dockerfile --output amd64-bins .
29+
30+
- name: Build arm64 with Docker
31+
run: docker buildx build --builder multi-arch --platform linux/arm64 -f release/Dockerfile --output arm64-bins .
32+
33+
- name: List built binaries
34+
run: ls -lah amd64-bins arm64-bins
35+
36+
- name: Create tar
37+
run: |
38+
tar -czf criu-${{ github.ref_name}}-linux-amd64.tar.gz -C amd64-bins criu
39+
tar -czf criu-${{ github.ref_name}}-linux-arm64.tar.gz -C arm64-bins criu
40+
sha256sum criu-${{ github.ref_name}}-linux-amd64.tar.gz >> SHA256SUMS
41+
sha256sum criu-${{ github.ref_name}}-linux-arm64.tar.gz >> SHA256SUMS
42+
43+
- name: Upload Release Asset
44+
uses: ncipollo/release-action@v1
45+
with:
46+
artifacts: "criu-${{ github.ref_name}}-linux-amd64.tar.gz,criu-${{ github.ref_name}}-linux-arm64.tar.gz,SHA256SUMS"
47+
env:
48+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
49+
50+

criu/Makefile

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
LDFLAGS += -static
2+
WRAPFLAGS += -Wl,--wrap=__strlcpy
3+
14
# here is a workaround for a bug in libnl-3:
25
# 6a8d90f5fec4 "attr: Allow attribute type 0"
36
WRAPFLAGS += -Wl,--wrap=nla_parse,--wrap=nlmsg_parse

criu/string.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
* of course, the buffer size is zero). It does not pad
1818
* out the result like strncpy() does.
1919
*/
20-
size_t __strlcpy(char *dest, const char *src, size_t size)
20+
size_t __wrap___strlcpy(char *dest, const char *src, size_t size)
2121
{
2222
size_t ret = strlen(src);
2323

release/Dockerfile

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
FROM ubuntu:24.04 AS build
2+
3+
RUN DEBIAN_FRONTEND=noninteractive apt-get update && apt-get install -y \
4+
libnet-dev \
5+
libnl-route-3-dev \
6+
gcc \
7+
bsdmainutils \
8+
build-essential \
9+
git-core \
10+
iptables \
11+
libaio-dev \
12+
libbsd-dev \
13+
libcap-dev \
14+
libnl-3-dev \
15+
libprotobuf-c-dev \
16+
libprotobuf-dev \
17+
libselinux-dev \
18+
libpcre2-dev \
19+
iproute2 \
20+
kmod \
21+
pkg-config \
22+
protobuf-c-compiler \
23+
protobuf-compiler \
24+
python3-minimal \
25+
python3-protobuf \
26+
uuid-dev \
27+
python3-yaml
28+
29+
COPY . /work
30+
WORKDIR /work
31+
RUN make -j $(nproc) criu
32+
33+
FROM scratch
34+
COPY --from=build /work/criu/criu .

0 commit comments

Comments
 (0)