Skip to content
This repository was archived by the owner on Jun 6, 2023. It is now read-only.

Commit c0fe545

Browse files
committed
implements curl docker image and build/test/push processes (#5)
1 parent 7388172 commit c0fe545

File tree

8 files changed

+320
-0
lines changed

8 files changed

+320
-0
lines changed

.gitignore

+65
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
*.asc
2+
*.dll
3+
*.exe
4+
*.exp
5+
*.la
6+
*.lib
7+
*.lo
8+
*.o
9+
*.obj
10+
*.pdb
11+
*.pyc
12+
*~
13+
.*.sw?
14+
.cproject
15+
.deps
16+
.dirstamp
17+
.libs
18+
.project
19+
.settings
20+
/.vs
21+
/build/
22+
/builds/
23+
__pycache__
24+
CHANGES.dist
25+
Debug
26+
INSTALL
27+
Makefile
28+
Makefile.in
29+
Release
30+
TAGS
31+
aclocal.m4
32+
aclocal.m4.bak
33+
autom4te.cache
34+
compile
35+
config.cache
36+
config.guess
37+
config.log
38+
config.status
39+
config.sub
40+
configure
41+
curl-*.tar.bz2
42+
curl-*.tar.gz
43+
curl-*.tar.xz
44+
curl-*.zip
45+
curl-config
46+
depcomp
47+
install-sh
48+
libcurl.pc
49+
libtool
50+
ltmain.sh
51+
missing
52+
mkinstalldirs
53+
tags
54+
test-driver
55+
scripts/_curl
56+
scripts/curl.fish
57+
curl_fuzzer
58+
curl_fuzzer_seed_corpus.zip
59+
libstandaloneengine.a
60+
.checksrc
61+
62+
.idea
63+
curl.tar.gz
64+
setup
65+
.DS_Store

.travis.yml

+18
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
language: minimal
2+
3+
sudo: required
4+
dist: trusty
5+
6+
before_script:
7+
- echo '{"experimental":true}' | sudo tee /etc/docker/daemon.json
8+
- sudo service docker restart
9+
10+
script: make all
11+
12+
branches:
13+
only:
14+
- master
15+
- /\/ci$/
16+
17+
notifications:
18+
email: false

README.md

+61
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
[![Build Status](https://travis-ci.org/curl/curl-docker.svg?branch=master)](https://travis-ci.org/curl/curl-docker)
2+
3+
# Curl Docker Images repository
4+
5+
This repository defines internal & official curl docker images.
6+
7+
* [alpine](alpine/)
8+
9+
which are published to hub.docker.com.
10+
11+
__note__ - requires latest docker to be installed and available
12+
13+
## Using Images
14+
15+
### get docker image
16+
17+
```
18+
$ docker pull curlimages/curl:...insert tag...
19+
```
20+
21+
### run docker image
22+
23+
```
24+
$ docker run -it curlimages/curl:...insert tag... --version
25+
```
26+
27+
### building and testing images
28+
29+
To build and test all curl docker images
30+
```
31+
$ make all
32+
```
33+
which runs the setup (clean), build and test targets.
34+
35+
### scanning images
36+
37+
Security scan of resultant docker images
38+
```
39+
$ make scan
40+
```
41+
which uses anchore-engine, rkhunter, lynis and clamav.
42+
43+
One can also run lint checker on dockerfiles
44+
```
45+
$ make lint
46+
```
47+
48+
## Image design
49+
50+
* initial stage, build curl and then copy over to clean base image
51+
* build static curl
52+
* attempt to be idiomatic across image(s)
53+
54+
### Other
55+
56+
* [thanks](docs/THANKS) to contributors
57+
* Daniel Stenberg
58+
* Max Dymond
59+
* Olliver Schinagl
60+
61+

alpine/latest/Dockerfile

+91
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,91 @@
1+
###############################################################
2+
#
3+
# Copyright (C) 2019 James Fuller <[email protected]>
4+
#
5+
# SPDX-License-Identifier: MIT
6+
#
7+
# pinning to Alpine 3.10.2 as base image
8+
###############################################################
9+
FROM registry.hub.docker.com/library/alpine:3.10.2 AS builder
10+
11+
###############################################################
12+
# set build args
13+
###############################################################
14+
ARG CURL_RELEASE_TAG=latest
15+
ARG CURL_GIT_REPO=https://github.com/curl/curl.git
16+
ARG CURL_CONFIGURE_OPTION
17+
ARG LABEL_VERSION=1.0.0
18+
ARG LABEL_NAME=curl
19+
ARG LABEL_DESC=curl
20+
21+
###############################################################
22+
# build curl
23+
###############################################################
24+
# install deps and use latest curl release source
25+
RUN \
26+
apk add --no-cache \
27+
autoconf \
28+
automake \
29+
build-base \
30+
curl-dev \
31+
groff \
32+
libtool \
33+
&& \
34+
rm -rf "/var/cache/apk/"*
35+
36+
RUN mkdir /src
37+
COPY "curl" "/src/curl"
38+
WORKDIR "/src/curl"
39+
40+
RUN ./buildconf && \
41+
autoreconf -vif && \
42+
./configure ${CURL_CONFIGURE_OPTION} &&\
43+
make -j$(nproc) &&\
44+
make DESTDIR="/alpine/" install -j$(nproc)
45+
46+
###############################################################
47+
# pinning to Alpine 3.10.2
48+
###############################################################
49+
FROM registry.hub.docker.com/library/alpine:3.10.2
50+
51+
ARG CURL_RELEASE_TAG=latest
52+
ARG CURL_RELEASE_VERSION
53+
ARG CURL_GIT_REPO=https://github.com/curl/curl.git
54+
55+
ENV CURL_VERSION ${CURL_RELEASE_VERSION}
56+
ENV CURL_RELEASE_TAG ${CURL_RELEASE_TAG}
57+
ENV CURL_GIT_REPO ${CURL_GIT_REPO}
58+
59+
###############################################################
60+
# define docker labels
61+
###############################################################
62+
LABEL Maintainer="James Fuller <[email protected]>"
63+
LABEL Name="curl"
64+
LABEL Version="${LABEL_VERSION}"
65+
LABEL docker.cmd="docker run -it curl/curl:${CURL_RELEASE_VERSION} http://curl.haxx.se"
66+
67+
###############################################################
68+
# remove curl
69+
###############################################################
70+
RUN apk del --no-cache curl && \
71+
apk add --no-cache nghttp2 ca-certificates
72+
73+
###############################################################
74+
# add non privileged curl user
75+
###############################################################
76+
RUN addgroup -S curl_group && adduser -S curl_user -G curl_group
77+
78+
###############################################################
79+
# install curl built from builder
80+
###############################################################
81+
COPY --from=builder "/alpine/usr/local/lib/libcurl.so" "/usr/lib/libcurl.so"
82+
COPY --from=builder "/alpine/usr/local/lib/libcurl.so.4" "/usr/lib/libcurl.so.4"
83+
COPY --from=builder "/alpine/usr/local/bin/curl" "/usr/bin/curl"
84+
85+
###############################################################
86+
# copy and set entrypoint
87+
###############################################################
88+
COPY "entrypoint.sh" "/entrypoint.sh"
89+
USER curl_user
90+
ENTRYPOINT ["/entrypoint.sh"]
91+
CMD ["curl"]

alpine/latest/entrypoint.sh

+14
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
#!/bin/sh
2+
#
3+
# Copyright (C) 2019 James Fuller <[email protected]>
4+
#
5+
# SPDX-License-Identifier: MIT
6+
#
7+
8+
set -e
9+
10+
if [ "${1#-}" != "${1}" ] || [ -z "$(command -v "${1}")" ]; then
11+
set -- curl "$@"
12+
fi
13+
14+
exec "$@"

alpine/latest/test-container.yml

+14
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
schemaVersion: "2.0.0"
2+
3+
metadataTest:
4+
labels:
5+
- key: 'se.haxx.curl'
6+
value: 'curl'
7+
exposedPorts: []
8+
entrypoint: ["/entrypoint.sh"]
9+
workdir: ""
10+
11+
fileExistenceTests:
12+
- name: 'curl'
13+
path: '/usr/bin/curl'
14+
shouldExist: true

docs/dockerhub_docs.md

+39
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
# Supported tags and respective Dockerfile links
2+
3+
* [7_65_3](), [latest]()
4+
5+
# Quick reference
6+
* Where to get help: [website](https://curl.haxx.se/), [mailing lists](https://curl.haxx.se/mail/), [Everything Curl](https://curl.haxx.se/book.html)
7+
* Where to file issues: https://github.com/curl/curl-docker/issues
8+
* Maintained by: The curl docker team
9+
* License(s) - [license](https://curl.haxx.se/docs/copyright.html), check 3rd party documentation for license information
10+
* Supported architectures: (more info)
11+
* github repo: [curl/curl-docker](https://github.com/curl/curl-docker)
12+
13+
# What is Curl ?
14+
[curl](https://curl.haxx.se/) is a command line tool and library for transferring data with URLs.
15+
16+
[curl](https://curl.haxx.se/) is used in command lines or scripts to transfer data. It is also used in cars, television sets, routers, printers, audio equipment, mobile phones, tablets, settop boxes, media players and is the internet transfer backbone for thousands of software applications affecting billions of humans daily.
17+
18+
Supports the following protocols (so far!):.
19+
20+
DICT, FILE, FTP, FTPS, Gopher, HTTP, HTTPS, IMAP, IMAPS, LDAP, LDAPS, POP3, POP3S, RTMP, RTSP, SCP, SFTP, SMB, SMBS, SMTP, SMTPS, Telnet and TFTP. curl supports SSL certificates, HTTP POST, HTTP PUT, FTP uploading, HTTP form based upload, proxies, HTTP/2, cookies, user+password authentication (Basic, Plain, Digest, CRAM-MD5, NTLM, Negotiate and Kerberos), file transfer resume, proxy tunneling and more.
21+
22+
# How to use this image
23+
24+
### get docker image
25+
26+
```
27+
> docker pull curlimages/curl:... insert tag ...
28+
```
29+
30+
### run docker image
31+
```
32+
> docker run --rm -it curlimages/curl:... insert tag ... --version
33+
```
34+
Here is a more specific example
35+
```
36+
> docker run --rm -it curlimages/curl:7_65_3 -v https://curl.haxx.se
37+
```
38+
39+

setup.sh

+18
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
#!/usr/bin/env bash
2+
3+
# deduce latest release from github
4+
echo "get curl latest release source"
5+
release_tag_redirect=`curl -s https://github.com/curl/curl/releases/latest -w'%{redirect_url}\n' -o /dev/null`
6+
export latest_release_tag=`basename ${release_tag_redirect}`
7+
latest_release_tarball="https://github.com/curl/curl/archive/${latest_release_tag}.tar.gz"
8+
echo $latest_release_tarball
9+
curl -L -o curl.tar.gz $latest_release_tarball && tar -xvf curl.tar.gz &&mv curl-${latest_release_tag} curl
10+
11+
# download container-structure-test tool
12+
echo "get container-structure-test tool for tests"
13+
if [[ "$OSTYPE" == "darwin"* ]]; then
14+
curl -LO https://storage.googleapis.com/container-structure-test/latest/container-structure-test-darwin-amd64 && chmod +x container-structure-test-darwin-amd64 && mkdir -p bin && mv container-structure-test-darwin-amd64 bin/container-structure-test
15+
else
16+
echo "install container structure test, requires sudo"
17+
curl -LO https://storage.googleapis.com/container-structure-test/latest/container-structure-test-linux-amd64 && chmod +x container-structure-test-linux-amd64 && mkdir -p bin && mv container-structure-test-linux-amd64 bin/container-structure-test
18+
fi

0 commit comments

Comments
 (0)