This repository has been archived by the owner on Jun 6, 2023. It is now read-only.
-
-
Notifications
You must be signed in to change notification settings - Fork 67
/
Dockerfile
109 lines (93 loc) · 3.98 KB
/
Dockerfile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
###############################################################
#
# Copyright (C) 2020 James Fuller <[email protected]>
#
# SPDX-License-Identifier: MIT
#
# pinning builder image to Alpine 3.15.2
###############################################################
FROM registry.hub.docker.com/library/alpine:3.15.2 AS builder
###############################################################
# set build args
###############################################################
ARG CURL_RELEASE_TAG=latest
ARG CURL_GIT_REPO=https://github.com/curl/curl.git
ARG CURL_CONFIGURE_OPTION
ARG LABEL_VERSION=1.0.0
ARG LABEL_NAME=curl
ARG LABEL_DESC=curl
###############################################################
# build curl
###############################################################
# install deps and use latest curl release source
RUN apk add libssh2 libssh2-dev libssh2-static \
autoconf automake build-base \
groff openssl curl-dev \
python3 python3-dev \
libtool curl stunnel perl \
nghttp2 brotli brotli-dev
RUN mkdir /src
COPY "curl" "/src/curl"
WORKDIR /src/curl
###############################################################
# get ca cert bundle from curl.haxx.se
###############################################################
RUN curl https://curl.haxx.se/ca/cacert.pem -L -o /cacert.pem
###############################################################
# build the tag version
###############################################################
RUN ./buildconf && \
autoreconf -vif && \
./configure ${CURL_CONFIGURE_OPTION} &&\
make -j$(nproc) &&\
#make test &&\
make DESTDIR="/alpine/" install -j$(nproc)
###############################################################
# pinning image to Alpine 3.15.2
###############################################################
FROM registry.hub.docker.com/library/alpine:3.15.2
ARG CURL_RELEASE_TAG=latest
ARG CURL_RELEASE_VERSION
ARG CURL_GIT_REPO=https://github.com/curl/curl.git
ENV CURL_VERSION ${CURL_RELEASE_VERSION}
ENV CURL_RELEASE_TAG ${CURL_RELEASE_TAG}
ENV CURL_GIT_REPO ${CURL_GIT_REPO}
###############################################################
# define docker labels
###############################################################
LABEL maintainer="James Fuller <[email protected]>"
LABEL name="${LABEL_NAME}"
LABEL version="${LABEL_VERSION}"
LABEL docker.cmd="docker run -it curl/curl:7.78.0 -s -L http://curl.se"
###############################################################
# dependencies
###############################################################
RUN apk add --no-cache brotli brotli-dev libssh2 nghttp2-dev && \
rm -fr /var/cache/apk/*
###############################################################
# add non privileged curl user
###############################################################
RUN addgroup -S curl_group && adduser -S curl_user -G curl_group
###############################################################
# set curl ca bundle
###############################################################
COPY --from=builder "/cacert.pem" "/cacert.pem"
ENV CURL_CA_BUNDLE="/cacert.pem"
###############################################################
# install curl built from builder
###############################################################
COPY --from=builder "/alpine/usr/local/lib/libcurl.so.4.7.0" "/usr/lib/"
COPY --from=builder "/alpine/usr/local/bin/curl" "/usr/bin/curl"
# explicitly set symlinks
RUN ln -s /usr/lib/libcurl.so.4.7.0 /usr/lib/libcurl.so.4
RUN ln -s /usr/lib/libcurl.so.4 /usr/lib/libcurl.so
###############################################################
# set user
###############################################################
USER curl_user
###############################################################
# set entrypoint
###############################################################
COPY "entrypoint.sh" "/entrypoint.sh"
CMD ["curl"]
ENTRYPOINT ["/entrypoint.sh"]