mirror of https://github.com/dswd/vpncloud.git
Build chain for deb packages
This commit is contained in:
parent
c5ba4b197b
commit
73fd3134a5
|
@ -6,3 +6,4 @@ deb/vpncloud/vpncloud
|
|||
deb/vpncloud/vpncloud.1*
|
||||
Stats.ods
|
||||
dist
|
||||
builder/cache
|
||||
|
|
|
@ -0,0 +1,2 @@
|
|||
cache
|
||||
build.sh
|
|
@ -0,0 +1,27 @@
|
|||
FROM debian:stable
|
||||
|
||||
RUN apt-get update \
|
||||
&& apt-get install -y --no-install-recommends \
|
||||
curl ruby-ronn build-essential gcc-arm-linux-gnueabihf libc6-dev-armhf-cross \
|
||||
&& rm -rf /var/cache/dpkg
|
||||
|
||||
RUN useradd -ms /bin/bash user
|
||||
USER user
|
||||
WORKDIR /home/user
|
||||
|
||||
ENV RUST=1.32.0
|
||||
|
||||
RUN curl https://sh.rustup.rs -sSf | sh -s -- -y --default-toolchain ${RUST}
|
||||
|
||||
ENV PATH=/home/user/.cargo/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
|
||||
|
||||
RUN rustup target add i686-unknown-linux-gnu \
|
||||
&& rustup target add armv7-unknown-linux-gnueabihf
|
||||
|
||||
RUN cargo install cargo-deb \
|
||||
&& rm -rf /home/user/.cargo/{git,tmp,registry}
|
||||
|
||||
VOLUME /home/user/.cargo/tmp
|
||||
VOLUME /home/user/.cargo/git
|
||||
VOLUME /home/user/.cargo/registry
|
||||
|
|
@ -0,0 +1,32 @@
|
|||
#!/bin/bash
|
||||
|
||||
function docker_cmd() {
|
||||
DIST=$1
|
||||
CMD=$2
|
||||
docker run -it --rm -v $(pwd)/..:/home/user/code \
|
||||
-v $CACHE/registry:/home/user/.cargo/registry \
|
||||
-v $CACHE/git:/home/user/.cargo/git \
|
||||
-v $CACHE/tmp:/home/user/.cargo/tmp \
|
||||
vpncloud-builder-$DIST bash -c "$CMD"
|
||||
}
|
||||
|
||||
set -e
|
||||
|
||||
cd $(dirname $0)
|
||||
|
||||
VERSION=$(grep -e '^version =' ../Cargo.toml | sed -e 's/version = "\(.*\)"/\1/')
|
||||
|
||||
mkdir -p cache/{git,tmp,registry}
|
||||
CACHE=$(pwd)/cache
|
||||
|
||||
mkdir -p ../dist
|
||||
|
||||
docker build --rm -f=Dockerfile-deb -t vpncloud-builder-deb .
|
||||
|
||||
# x86_64 deb
|
||||
docker_cmd deb 'cd code && cargo deb'
|
||||
cp ../target/debian/vpncloud_${VERSION}_amd64.deb ../dist/vpncloud_${VERSION}_amd64.deb
|
||||
|
||||
# arm7hf deb
|
||||
docker_cmd deb 'cd code && cargo deb --target armv7-unknown-linux-gnueabihf'
|
||||
cp ../target/armv7-unknown-linux-gnueabihf/debian/vpncloud_${VERSION}_armhf.deb ../dist/vpncloud_${VERSION}_armhf.deb
|
Loading…
Reference in New Issue