Skip to content

Commit

Permalink
feat(docker): add curl and jq binaries
Browse files Browse the repository at this point in the history
This is the work of @chmuche
CleverCloud/clever-tools-dockerhub#6

but applied on the dockertemplate
  • Loading branch information
miton18 committed Jul 5, 2024
1 parent 776e024 commit f165509
Show file tree
Hide file tree
Showing 3 changed files with 45 additions and 5 deletions.
10 changes: 6 additions & 4 deletions templates/dockerhub/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ RUN curl --output clever-tools_linux.tar.gz https://clever-tools.clever-cloud.co
# Only grep the clever-tools binary and his libraries for the release stage
# We use ldd to find the shared object dependencies.
RUN \
mkdir -p /tmp/fakeroot/lib && \
mkdir -p /tmp/fakeroot/lib && \
cp $(ldd /usr/local/bin/clever | grep -o '/.\+\.so[^ ]*' | sort | uniq) /tmp/fakeroot/lib && \
for lib in /tmp/fakeroot/lib/*; do strip --strip-all $lib; done && \
mkdir -p /tmp/fakeroot/bin/ && \
Expand All @@ -28,9 +28,11 @@ LABEL version="<%= version %>" \
VOLUME ["/actions"]
WORKDIR /actions

COPY --from=build /tmp/fakeroot/ /
RUN mkdir -p /etc/ssl/certs
COPY --from=build /etc/ssl/certs/ca-certificates.crt /etc/ssl/certs/ca-certificates.crt

## The loader search ld-linux-x86-64.so.2 in /lib64 but the folder does not exist
RUN ln -s lib lib64
COPY --from=build /tmp/fakeroot/ /
COPY --from=ghcr.io/tarampampam/curl:8.6.0 /bin/curl /usr/bin/curl
COPY --from=ghcr.io/jqlang/jq /jq /usr/bin/jq

ENTRYPOINT ["clever"]
2 changes: 1 addition & 1 deletion templates/dockerhub/README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Clever Tools Docker Image

This is a lightweight Docker image intended to be used mostly in CI environment.
This is a lightweight Docker image intended to be used mostly in CI environment.

## How to use

Expand Down
38 changes: 38 additions & 0 deletions templates/dockerhub/test/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
FROM debian AS build

RUN apt-get update && apt-get install -y \
libtool \
curl

RUN curl --output clever-tools_linux.tar.gz https://clever-tools.clever-cloud.com/releases/3.8.1/clever-tools-3.8.1_linux.tar.gz \
&& mkdir clever-tools_linux \
&& tar xvzf clever-tools_linux.tar.gz -C clever-tools_linux --strip-components=1 \
&& cp clever-tools_linux/clever /usr/local/bin

# Only grep the clever-tools binary and his libraries for the release stage
# We use ldd to find the shared object dependencies.
RUN \
mkdir -p /tmp/fakeroot/lib && \
cp $(ldd /usr/local/bin/clever | grep -o '/.\+\.so[^ ]*' | sort | uniq) /tmp/fakeroot/lib && \
for lib in /tmp/fakeroot/lib/*; do strip --strip-all $lib; done && \
mkdir -p /tmp/fakeroot/bin/ && \
cp /usr/local/bin/clever /tmp/fakeroot/bin/

FROM busybox:glibc AS release

LABEL version="3.8.1" \
maintainer="<%= maintainer %>" \
description="<%= description %>" \
license="<%= license %>"

VOLUME ["/actions"]
WORKDIR /actions

RUN mkdir -p /etc/ssl/certs
COPY --from=build /etc/ssl/certs/ca-certificates.crt /etc/ssl/certs/ca-certificates.crt

COPY --from=build /tmp/fakeroot/ /
COPY --from=ghcr.io/tarampampam/curl:8.6.0 /bin/curl /usr/bin/curl
COPY --from=ghcr.io/jqlang/jq /jq /usr/bin/jq

ENTRYPOINT ["sh"]

0 comments on commit f165509

Please sign in to comment.