Skip to content

Instantly share code, notes, and snippets.

@kipras
Last active January 28, 2019 13:24
Show Gist options
  • Save kipras/2c67ec2bbde17fc649a8d56630048e46 to your computer and use it in GitHub Desktop.
Save kipras/2c67ec2bbde17fc649a8d56630048e46 to your computer and use it in GitHub Desktop.
curl-7.61.0 openssl-1.1.1 nghttp2-1.32.0
# This is a Dockerfile for building a Docker image containing a recent `curl`, with HTTP/2 and
# TLSv1.3 support. The exact versions of `curl` and it's dependencies that are used are:
# curl-7.61.0
# openssl-1.1.1
# nghttp2-1.32.0
#
# Building
# 1. download `curl.Dockerfile`
# 2. run
# docker build -t curl -t curl:7.61.0 -f curl.Dockerfile .
#
# Running
# Once the image is built - you can use it to run the built `curl` as a command, by simply adding a
# `docker run --rm` prefix, like this:
# docker run --rm curl [curl_options]
#
# e.g.:
# docker run --rm curl https://www.google.com/
FROM ubuntu:xenial
WORKDIR /root
RUN apt-get update && apt-get install -y wget bzip2 make perl gcc pkg-config zlib1g-dev
# download and compile OpenSSL
RUN wget https://www.openssl.org/source/openssl-1.1.1.tar.gz
RUN tar -xvf openssl-1.1.1.tar.gz
RUN cd openssl-1.1.1 && ./config
RUN cd openssl-1.1.1 && make -j8
# RUN cd openssl-1.1.1 && make test
RUN cd openssl-1.1.1 && make install
RUN ldconfig
# download and compile nghttp2
RUN wget https://github.com/nghttp2/nghttp2/releases/download/v1.32.0/nghttp2-1.32.0.tar.bz2
RUN tar -xvf nghttp2-1.32.0.tar.bz2
RUN cd nghttp2-1.32.0 && ./configure
RUN cd nghttp2-1.32.0 && make -j8
RUN cd nghttp2-1.32.0 && make install
RUN ldconfig
# download and compile curl
RUN wget https://curl.haxx.se/download/curl-7.61.0.tar.bz2
RUN tar -xvf curl-7.61.0.tar.bz2
RUN cd curl-7.61.0 && ./configure --with-nghttp2
RUN cd curl-7.61.0 && make -j8
RUN cd curl-7.61.0 && make install
RUN ldconfig
# cleanup (so the image takes less space)
RUN rm -rf openssl-*
RUN rm -rf nghttp2-*
RUN rm -rf curl-*
RUN apt-get purge -y wget bzip2 make perl gcc pkg-config zlib1g-dev
RUN apt-get autoremove -y
RUN apt-get clean && apt-get autoclean
RUN rm -rf /var/cache/apt
ENTRYPOINT ["curl"]
@kipras
Copy link
Author

kipras commented Jan 28, 2019

What probably happened was the build context was being sent to the Docker deamon. I'm guessing you ran docker build from your downloads directory, which probably contained a lot of stuff.

docker build . sends the whole directory where the Dockerfile is to Docker daemon, that's why you want to run it from an empty directory preferably (as this Dockerfile does not reference anything from the host machine).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment