Skip to content

Commit

Permalink
chore: Upgrade to Ubuntu 24.04 and optimize Dockerfile build stages
Browse files Browse the repository at this point in the history
- Updated base images to ubuntu:24.04.
- Replaced apt with apt-get for improved reliability and added --no-install-recommends to reduce image size.
- Added WORKDIR commands to simplify directory handling in build stages.
- Cleaned up apt cache to streamline the build process.
  • Loading branch information
Khalid authored and Khalid committed Nov 1, 2024
1 parent 530a794 commit ec68e9f
Showing 1 changed file with 42 additions and 11 deletions.
53 changes: 42 additions & 11 deletions curl/Dockerfile-QUIC
Original file line number Diff line number Diff line change
@@ -1,22 +1,53 @@
FROM ubuntu:latest AS build
FROM ubuntu:24.04 AS build

ARG CURL_VERSION=8.10.1
ARG QUICHE_VERSION=0.22.0

RUN apt update && apt install cmake gcc ninja-build libunwind-dev pkg-config build-essential cargo git wget -y && cd /root && \
# Clone BoringSSL&liboqs
git clone --branch master https://github.com/open-quantum-safe/boringssl.git bssl && git clone --branch main --single-branch --depth 1 https://github.com/open-quantum-safe/liboqs.git && \
RUN apt-get update -y && \
apt-get install --no-install-recommends -y cmake gcc ninja-build libunwind-dev pkg-config build-essential cargo git wget && \
rm -rf /var/lib/apt/lists/*

# Set working directory to /root
WORKDIR /root

# Clone BoringSSL and liboqs
RUN git clone --branch master https://github.com/open-quantum-safe/boringssl.git bssl && \
git clone --branch main --single-branch --depth 1 https://github.com/open-quantum-safe/liboqs.git

# Build liboqs
cd liboqs && mkdir build && cd build && cmake -G"Ninja" -DCMAKE_INSTALL_PREFIX=../../bssl/oqs -DOQS_USE_OPENSSL=OFF .. && ninja && ninja install && \
WORKDIR /root/liboqs/build
RUN cmake -G"Ninja" -DCMAKE_INSTALL_PREFIX=../../bssl/oqs -DOQS_USE_OPENSSL=OFF .. && \
ninja && ninja install

# Build BoringSSL
cd /root/bssl && mkdir build && cd build && cmake -GNinja -DCMAKE_BUILD_TYPE=Release -DBUILD_SHARED_LIBS=1 .. && ninja && ninja install && cp -rp ../install/include /usr/local/include/bssl && cp -rp ../install/lib /usr/local/lib/bssl && \
# Build quiche
cd /root && git clone --recursive -b ${QUICHE_VERSION} https://github.com/cloudflare/quiche && cd quiche/quiche/deps && rm -R boringssl && ln -s /root/bssl boringssl && cd /root/quiche && cargo build --package quiche --release --features ffi,pkg-config-meta,qlog && cp -p target/release/libquiche.so /usr/local/lib/bssl/libquiche.so.0 && \
# Build curl
cd /root && wget https://curl.se/download/curl-${CURL_VERSION}.tar.gz && tar -zxf curl-${CURL_VERSION}.tar.gz && rm -R curl-${CURL_VERSION}.tar.gz && mv curl-${CURL_VERSION} curl && cd curl && LIBS=-lpthread ./configure LDFLAGS="-Wl,-rpath,/usr/local/lib/bssl" --with-openssl=/root/bssl/install --with-quiche=/root/quiche/target/release --without-libpsl --prefix="/usr/local/curl" && make && make install
WORKDIR /root/bssl/build
RUN cmake -GNinja -DCMAKE_BUILD_TYPE=Release -DBUILD_SHARED_LIBS=1 .. && \
ninja && ninja install && \
cp -rp ../install/include /usr/local/include/bssl && \
cp -rp ../install/lib /usr/local/lib/bssl

# Clone and build quiche
WORKDIR /root
RUN git clone --recursive -b ${QUICHE_VERSION} https://github.com/cloudflare/quiche && \
rm -R quiche/quiche/deps/boringssl && \
ln -s /root/bssl quiche/quiche/deps/boringssl && \
cd quiche && \
cargo build --package quiche --release --features ffi,pkg-config-meta,qlog && \
cp -p target/release/libquiche.so /usr/local/lib/bssl/libquiche.so.0

# Clone and build curl
RUN wget https://curl.se/download/curl-${CURL_VERSION}.tar.gz && \
tar -zxf curl-${CURL_VERSION}.tar.gz && rm -R curl-${CURL_VERSION}.tar.gz && \
mv curl-${CURL_VERSION} curl

WORKDIR /root/curl
RUN LIBS=-lpthread ./configure LDFLAGS="-Wl,-rpath,/usr/local/lib/bssl" \
--with-openssl=/root/bssl/install --with-quiche=/root/quiche/target/release --without-libpsl \
--prefix="/usr/local/curl" && \
make && make install

FROM ubuntu:latest
# Stage 2: Final image
FROM ubuntu:24.04

COPY --from=build /usr/local/include/bssl /usr/local/include/bssl
COPY --from=build /usr/local/lib/bssl /usr/local/lib/bssl
Expand Down

0 comments on commit ec68e9f

Please sign in to comment.