Improve Dockerfile contrib using bin/*sh

This commit is contained in:
Filipe PINTO 2023-05-05 09:08:45 +02:00 committed by jcamiel
parent 1fbf097ba8
commit 7f65ced598
No known key found for this signature in database
GPG Key ID: 07FF11CFD55356CC
2 changed files with 11 additions and 5 deletions

View File

@ -1,10 +1,13 @@
FROM alpine:3.17 AS builder FROM alpine:3.17 AS builder
WORKDIR /tmp WORKDIR /tmp
ARG hurl_latest_version ARG hurl_latest_version
RUN apk add --no-cache git=* jq=* curl=* cargo=* gcc=* libffi-dev=* libxml2-dev=* libxml2-utils=* openssl-dev=* && \ # hadolint ignore=DL3018
git clone --quiet --depth 1 --branch ${hurl_latest_version} https://github.com/Orange-OpenSource/hurl.git RUN apk add --no-cache bash git && \
git clone --quiet --depth 1 --branch ${hurl_latest_version} https://github.com/Orange-OpenSource/hurl.git /tmp/hurl
WORKDIR /tmp/hurl WORKDIR /tmp/hurl
RUN cargo build --release --verbose --bin hurl RUN bash -c bin/install_prerequisites_alpine.sh && \
bash -c bin/install_rust.sh && \
bash -c ./bin/release/release.sh
FROM alpine:3.17 AS runner FROM alpine:3.17 AS runner
ARG docker_build_date ARG docker_build_date
@ -24,6 +27,9 @@ 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.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.17" LABEL "com.orange.hurl.base.name"="alpine:3.17"
COPY --from=builder /tmp/hurl/target/release/hurl /usr/bin/ COPY --from=builder /tmp/hurl/target/release/hurl /usr/bin/
COPY --from=builder /usr/lib/libcurl.so.4 /usr/lib/
COPY --from=builder /usr/lib/libnghttp2.so.14 /usr/lib/
COPY --from=builder /usr/lib/libbrotli*.so.1 /usr/lib/
COPY --from=builder /usr/lib/libxml2.so.2 /usr/lib/ 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/libgcc_s.so.1 /usr/lib/
COPY --from=builder /usr/lib/liblzma.so.5 /usr/lib/ COPY --from=builder /usr/lib/liblzma.so.5 /usr/lib/

View File

@ -22,13 +22,13 @@ docker run --rm ghcr.io/orange-opensource/hurl:latest --version
# Run docker hurl from STDIN # Run docker hurl from STDIN
``` ```
echo -e "GET https://hurl.dev\n\nHTTP/1.1 200" | docker run --rm -i ghcr.io/orange-opensource/hurl:latest --test --color echo -e "GET https://hurl.dev\n\nHTTP 200" | docker run --rm -i ghcr.io/orange-opensource/hurl:latest --test --color
``` ```
# Run docker hurl from FILE # Run docker hurl from FILE
``` ```
echo -e "GET https://hurl.dev\n\nHTTP/1.1 200" > /tmp/test.hurl echo -e "GET https://hurl.dev\n\nHTTP 200" > /tmp/test.hurl
docker run --rm -v /tmp/test.hurl:/tmp/test.hurl ghcr.io/orange-opensource/hurl:latest --test --color /tmp/test.hurl docker run --rm -v /tmp/test.hurl:/tmp/test.hurl ghcr.io/orange-opensource/hurl:latest --test --color /tmp/test.hurl
``` ```