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

Commit

Permalink
implements curl docker image and build/test/push processes (#5)
Browse files Browse the repository at this point in the history
  • Loading branch information
xquery committed Aug 26, 2019
1 parent 7388172 commit c0fe545
Show file tree
Hide file tree
Showing 8 changed files with 320 additions and 0 deletions.
65 changes: 65 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
*.asc
*.dll
*.exe
*.exp
*.la
*.lib
*.lo
*.o
*.obj
*.pdb
*.pyc
*~
.*.sw?
.cproject
.deps
.dirstamp
.libs
.project
.settings
/.vs
/build/
/builds/
__pycache__
CHANGES.dist
Debug
INSTALL
Makefile
Makefile.in
Release
TAGS
aclocal.m4
aclocal.m4.bak
autom4te.cache
compile
config.cache
config.guess
config.log
config.status
config.sub
configure
curl-*.tar.bz2
curl-*.tar.gz
curl-*.tar.xz
curl-*.zip
curl-config
depcomp
install-sh
libcurl.pc
libtool
ltmain.sh
missing
mkinstalldirs
tags
test-driver
scripts/_curl
scripts/curl.fish
curl_fuzzer
curl_fuzzer_seed_corpus.zip
libstandaloneengine.a
.checksrc

.idea
curl.tar.gz
setup
.DS_Store
18 changes: 18 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
language: minimal

sudo: required
dist: trusty

before_script:
- echo '{"experimental":true}' | sudo tee /etc/docker/daemon.json
- sudo service docker restart

script: make all

branches:
only:
- master
- /\/ci$/

notifications:
email: false
61 changes: 61 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
[![Build Status](https://travis-ci.org/curl/curl-docker.svg?branch=master)](https://travis-ci.org/curl/curl-docker)

# Curl Docker Images repository

This repository defines internal & official curl docker images.

* [alpine](alpine/)

which are published to hub.docker.com.

__note__ - requires latest docker to be installed and available

## Using Images

### get docker image

```
$ docker pull curlimages/curl:...insert tag...
```

### run docker image

```
$ docker run -it curlimages/curl:...insert tag... --version
```

### building and testing images

To build and test all curl docker images
```
$ make all
```
which runs the setup (clean), build and test targets.

### scanning images

Security scan of resultant docker images
```
$ make scan
```
which uses anchore-engine, rkhunter, lynis and clamav.

One can also run lint checker on dockerfiles
```
$ make lint
```

## Image design

* initial stage, build curl and then copy over to clean base image
* build static curl
* attempt to be idiomatic across image(s)

### Other

* [thanks](docs/THANKS) to contributors
* Daniel Stenberg
* Max Dymond
* Olliver Schinagl


91 changes: 91 additions & 0 deletions alpine/latest/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,91 @@
###############################################################
#
# Copyright (C) 2019 James Fuller <[email protected]>
#
# SPDX-License-Identifier: MIT
#
# pinning to Alpine 3.10.2 as base image
###############################################################
FROM registry.hub.docker.com/library/alpine:3.10.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 --no-cache \
autoconf \
automake \
build-base \
curl-dev \
groff \
libtool \
&& \
rm -rf "/var/cache/apk/"*

RUN mkdir /src
COPY "curl" "/src/curl"
WORKDIR "/src/curl"

RUN ./buildconf && \
autoreconf -vif && \
./configure ${CURL_CONFIGURE_OPTION} &&\
make -j$(nproc) &&\
make DESTDIR="/alpine/" install -j$(nproc)

###############################################################
# pinning to Alpine 3.10.2
###############################################################
FROM registry.hub.docker.com/library/alpine:3.10.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="curl"
LABEL Version="${LABEL_VERSION}"
LABEL docker.cmd="docker run -it curl/curl:${CURL_RELEASE_VERSION} http://curl.haxx.se"

###############################################################
# remove curl
###############################################################
RUN apk del --no-cache curl && \
apk add --no-cache nghttp2 ca-certificates

###############################################################
# add non privileged curl user
###############################################################
RUN addgroup -S curl_group && adduser -S curl_user -G curl_group

###############################################################
# install curl built from builder
###############################################################
COPY --from=builder "/alpine/usr/local/lib/libcurl.so" "/usr/lib/libcurl.so"
COPY --from=builder "/alpine/usr/local/lib/libcurl.so.4" "/usr/lib/libcurl.so.4"
COPY --from=builder "/alpine/usr/local/bin/curl" "/usr/bin/curl"

###############################################################
# copy and set entrypoint
###############################################################
COPY "entrypoint.sh" "/entrypoint.sh"
USER curl_user
ENTRYPOINT ["/entrypoint.sh"]
CMD ["curl"]
14 changes: 14 additions & 0 deletions alpine/latest/entrypoint.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
#!/bin/sh
#
# Copyright (C) 2019 James Fuller <[email protected]>
#
# SPDX-License-Identifier: MIT
#

set -e

if [ "${1#-}" != "${1}" ] || [ -z "$(command -v "${1}")" ]; then
set -- curl "$@"
fi

exec "$@"
14 changes: 14 additions & 0 deletions alpine/latest/test-container.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
schemaVersion: "2.0.0"

metadataTest:
labels:
- key: 'se.haxx.curl'
value: 'curl'
exposedPorts: []
entrypoint: ["/entrypoint.sh"]
workdir: ""

fileExistenceTests:
- name: 'curl'
path: '/usr/bin/curl'
shouldExist: true
39 changes: 39 additions & 0 deletions docs/dockerhub_docs.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
# Supported tags and respective Dockerfile links

* [7_65_3](), [latest]()

# Quick reference
* Where to get help: [website](https://curl.haxx.se/), [mailing lists](https://curl.haxx.se/mail/), [Everything Curl](https://curl.haxx.se/book.html)
* Where to file issues: https://github.com/curl/curl-docker/issues
* Maintained by: The curl docker team
* License(s) - [license](https://curl.haxx.se/docs/copyright.html), check 3rd party documentation for license information
* Supported architectures: (more info)
* github repo: [curl/curl-docker](https://github.com/curl/curl-docker)

# What is Curl ?
[curl](https://curl.haxx.se/) is a command line tool and library for transferring data with URLs.

[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.

Supports the following protocols (so far!):.

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.

# How to use this image

### get docker image

```
> docker pull curlimages/curl:... insert tag ...
```

### run docker image
```
> docker run --rm -it curlimages/curl:... insert tag ... --version
```
Here is a more specific example
```
> docker run --rm -it curlimages/curl:7_65_3 -v https://curl.haxx.se
```


18 changes: 18 additions & 0 deletions setup.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
#!/usr/bin/env bash

# deduce latest release from github
echo "get curl latest release source"
release_tag_redirect=`curl -s https://github.com/curl/curl/releases/latest -w'%{redirect_url}\n' -o /dev/null`
export latest_release_tag=`basename ${release_tag_redirect}`
latest_release_tarball="https://github.com/curl/curl/archive/${latest_release_tag}.tar.gz"
echo $latest_release_tarball
curl -L -o curl.tar.gz $latest_release_tarball && tar -xvf curl.tar.gz &&mv curl-${latest_release_tag} curl

# download container-structure-test tool
echo "get container-structure-test tool for tests"
if [[ "$OSTYPE" == "darwin"* ]]; then
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
else
echo "install container structure test, requires sudo"
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
fi

0 comments on commit c0fe545

Please sign in to comment.