Skip to content

Commit

Permalink
lots of build fixes for new packaging including libssl
Browse files Browse the repository at this point in the history
Signed-off-by: Erik Hollensbe <[email protected]>
  • Loading branch information
erikh committed May 14, 2022
1 parent a40ff22 commit 856a30c
Show file tree
Hide file tree
Showing 6 changed files with 29 additions and 11 deletions.
2 changes: 1 addition & 1 deletion Cargo.lock

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

2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM ubuntu:latest as rustenv
FROM debian:latest as rustenv

ARG IS_LOCAL=0
ARG VERSION=main
Expand Down
11 changes: 8 additions & 3 deletions Dockerfile.alpine
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,20 @@

FROM alpine:latest as builder

RUN apk add rust
RUN apk add cargo
RUN apk add gcc
RUN apk add libgcc
RUN apk add musl-dev
RUN apk add openssl
RUN apk add openssl-dev
RUN apk add curl

RUN curl -sSL sh.rustup.rs >/usr/local/bin/rustup-dl && chmod +x /usr/local/bin/rustup-dl && /usr/local/bin/rustup-dl -y --default-toolchain stable

COPY . /zeronsd
WORKDIR /zeronsd

RUN cargo install --path .
ENV PATH=/root/.cargo/bin:${PATH}
RUN . /root/.cargo/env && cargo install --path .

FROM alpine:latest

Expand Down
9 changes: 7 additions & 2 deletions Dockerfile.packages
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
FROM rust
FROM debian:latest as rustenv

RUN cargo install cargo-deb cargo-generate-rpm
RUN apt-get update -qq && apt-get install curl pkg-config build-essential libssl1.1 ca-certificates -y && apt-get autoclean -y && apt-get clean -y
RUN curl -sSL sh.rustup.rs >/usr/local/bin/rustup-dl && chmod +x /usr/local/bin/rustup-dl && /usr/local/bin/rustup-dl -y --default-toolchain stable

FROM rustenv as buildenv

RUN . /root/.cargo/env && cargo install cargo-deb cargo-generate-rpm
7 changes: 7 additions & 0 deletions Dockerfile.ubi
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# vim: ft=dockerfile
FROM redhat/ubi8

RUN dnf install openssl-devel gcc -y
RUN curl -sSL sh.rustup.rs >/tmp/rustup.sh && bash /tmp/rustup.sh -y
ENV PATH=${PATH}:${HOME}/.cargo/bin
RUN . /root/.cargo/env && cargo install cargo-generate-rpm
9 changes: 5 additions & 4 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -40,10 +40,12 @@ docker-image-push: docker-image-package
packages:
make docker-image-package
mkdir -p target/packages
docker build -f Dockerfile.ubi -t zeronsd-packages-ubi .
docker run -it -v ${PWD}:/code -w /code --rm zeronsd-packages-ubi bash -c ". /root/.cargo/env && cargo build --release && cargo generate-rpm && mv /code/target/generate-rpm/*.rpm /code/target/packages"
docker build -f Dockerfile.ubuntu -t zeronsd-packages-ubuntu .
docker run -it -v ${PWD}:/code -w /code --rm zeronsd-packages-ubuntu bash -c "cargo deb --deb-version ${CARGO_VERSION}-ubuntu22 && mv /code/target/debian/*.deb /code/target/packages"
docker build -f Dockerfile.packages -t zeronsd-packages .
docker run -it -v ${PWD}:/code -w /code --rm zeronsd-packages bash -c "cargo deb && cargo-generate-rpm && mv /code/target/debian/*.deb /code/target/generate-rpm/*.rpm /code/target/packages "
docker run -it -v ${PWD}:/code -w /code --rm zeronsd-packages bash -c ". /root/.cargo/env && cargo deb && mv /code/target/debian/*.deb /code/target/packages"
make packages-out

packages-out:
Expand All @@ -61,9 +63,8 @@ clean:
sudo rm -rf target
cargo clean

test-packages: clean
make packages
docker run -v ${PWD}:/code --rm -it centos rpm -ivh /code/target/packages/\*.rpm
test-packages: clean packages
docker run -v ${PWD}:/code --rm -it redhat/ubi8 bash -c "rpm -ivh /code/target/packages/\*.rpm"
docker run -v ${PWD}:/code --rm -it debian:latest bash -c "apt update -qq && apt install libssl1.1 && dpkg -i /code/target/packages/zeronsd_${CARGO_VERSION}_amd64.deb"
docker run -v ${PWD}:/code --rm -it ubuntu:focal bash -c "apt update -qq && apt install libssl1.1 && dpkg -i /code/target/packages/zeronsd_${CARGO_VERSION}_amd64.deb"
docker run -v ${PWD}:/code --rm -it ubuntu:jammy bash -c "apt update -qq && apt install libssl3 && dpkg -i /code/target/packages/zeronsd_${CARGO_VERSION}-ubuntu22_amd64.deb"
Expand Down

0 comments on commit 856a30c

Please sign in to comment.