Update docker contrib

This commit is contained in:
lepapareil 2021-12-15 14:22:29 +01:00 committed by Fabrice Reix
parent 9101e26def
commit 4aa04de5c5
3 changed files with 55 additions and 5 deletions

View File

@ -1,13 +1,27 @@
FROM alpine:3.15 AS builder
WORKDIR /tmp
ARG hurl_latest_version
RUN apk add git jq curl cargo gcc libffi-dev libxml2-dev libxml2-utils openssl-dev
RUN git clone --quiet --depth 1 --branch $(curl --silent "https://api.github.com/repos/Orange-OpenSource/hurl/releases/latest" | jq -r .tag_name) https://github.com/Orange-OpenSource/hurl.git
RUN git clone --quiet --depth 1 --branch ${hurl_latest_version} https://github.com/Orange-OpenSource/hurl.git
WORKDIR /tmp/hurl
RUN cargo build --release --verbose --bin hurl
FROM alpine:3.15 AS runner
COPY --from=builder /tmp/hurl/target/release/hurl /usr/sbin/
ARG docker_build_date
ARG hurl_latest_version
LABEL "com.orange.hurl.created"="${docker_build_date}"
LABEL "com.orange.hurl.authors"="Fabrice REIX, Jean Christophe AMIEL, Orange-OpenSource"
LABEL "com.orange.hurl.url"="https://hurl.dev"
LABEL "com.orange.hurl.documentation"="https://hurl.dev"
LABEL "com.orange.hurl.source"="https://github.com/Orange-OpenSource/hurl"
LABEL "com.orange.hurl.version"=${hurl_latest_version}
LABEL "com.orange.hurl.vendor"="Orange-OpenSource"
LABEL "com.orange.hurl.licenses"="Apache-2.0"
LABEL "com.orange.hurl.title"="Hurl"
LABEL "com.orange.hurl.description"="Hurl is a command line tool that runs HTTP requests defined in a simple plain text format"
LABEL "com.orange.hurl.base.name"="alpine:3.15"
COPY --from=builder /tmp/hurl/target/release/hurl /usr/bin/
COPY --from=builder /usr/lib/libxml2.so.2 /usr/lib/
COPY --from=builder /usr/lib/libgcc_s.so.1 /usr/lib/
COPY --from=builder /usr/lib/liblzma.so.5 /usr/lib/
ENTRYPOINT ["/usr/sbin/hurl"]
ENTRYPOINT ["/usr/bin/hurl"]

View File

@ -1,7 +1,9 @@
# Build image
```
docker build --tag hurl:latest .
hurl_latest_version=$(curl --silent "https://api.github.com/repos/Orange-OpenSource/hurl/releases/latest" | jq -r .tag_name)
docker_build_date=$(date "+%Y-%m-%d %H-%M-%S")
docker build --build-arg docker_build_date="${docker_build_date}" --build-arg hurl_latest_version=${hurl_latest_version} --tag hurl:latest --tag hurl:${hurl_latest_version} .
```
# Get docker hurl version
@ -20,6 +22,6 @@ echo -e "GET https://hurl.dev\n\nHTTP/1.1 200" | docker run --rm -i hurl:latest
```
echo -e "GET https://hurl.dev\n\nHTTP/1.1 200" > /tmp/test.hurl
ocker run --rm -v /tmp/test.hurl:/tmp/test.hurl -w /tmp hurl:latest --test --color /tmp/test.hurl
docker run --rm -v /tmp/test.hurl:/tmp/test.hurl hurl:latest --test --color /tmp/test.hurl
```

View File

@ -0,0 +1,34 @@
# Quick references
- **Maintained by**: Filipe PINTO, Fabrice REIX (Orange-OpenSource/hurl maintainers).
- **Home**: https://hurl.dev
- **Where to get help**: https://github.com/Orange-OpenSource/hurl/issues
# What is Hurl ?
![logo](https://raw.githubusercontent.com/Orange-OpenSource/hurl/master/art/logo-mini-light.svg)
Hurl is a command line tool that runs HTTP requests defined in a simple plain text format.
It can perform requests, capture values and evaluate queries on headers and body response. Hurl is very versatile: it can be used for both fetching data and testing HTTP sessions.
# How to use this image
Get Hurl version:
```
docker run --rm orangeopensource/hurl:latest --version
```
Run Hurl from STDIN:
```
echo -e "GET https://hurl.dev\n\nHTTP/1.1 200" | docker run --rm -i orangeopensource/hurl:latest --test --color
```
Run Hurl from FILE:
```
echo -e "GET https://hurl.dev\n\nHTTP/1.1 200" > /tmp/test.hurl
docker run --rm -v /tmp/test.hurl:/tmp/test.hurl -w /tmp orangeopensource/hurl:latest --test --color /tmp/test.hurl
```