Update docker contrib with lightweight alpine based image

This commit is contained in:
lepapareil 2021-12-11 19:23:30 +01:00 committed by Fabrice Reix
parent 01262655e3
commit 7a0b4ac76d
3 changed files with 37 additions and 16 deletions

View File

@ -1,7 +1,13 @@
FROM debian:10.10
RUN apt update && apt install -y wget curl libxml2
ARG VERSION
RUN wget https://github.com/Orange-OpenSource/hurl/releases/download/${VERSION}/hurl_${VERSION}_amd64.deb
RUN apt install ./hurl_${VERSION}_amd64.deb
FROM alpine:3.15 AS builder
WORKDIR /tmp
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
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/
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"]

View File

@ -1,10 +0,0 @@
#export VERSION=$(grep '^version' ../../packages/hurl/Cargo.toml | cut -f2 -d'"')
export VERSION=1.4.0
# Build image
docker build . -t hurl:$VERSION --build-arg VERSION=$VERSION
# Run
docker run hurl:$VERSION hurl --version

25
contrib/docker/README.md Normal file
View File

@ -0,0 +1,25 @@
# Build image
```
docker build --tag hurl:latest .
```
# Get docker hurl version
```
docker run --rm hurl:latest --version
```
# Run docker hurl from STDIN
```
echo -e "GET https://hurl.dev\n\nHTTP/1.1 200" | docker run --rm -i hurl:latest --test --color
```
# Run docker hurl from FILE
```
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
```