-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile
81 lines (70 loc) · 2.65 KB
/
Dockerfile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
# syntax=docker/dockerfile:1
FROM ghcr.io/linuxserver/baseimage-alpine:3.20 AS build-stage
# set version label
ARG BUILD_DATE
ARG VERSION
ARG APP_VERSION
LABEL build_version="Version:- ${VERSION} Build-date:- ${BUILD_DATE}"
LABEL maintainer="thespad"
LABEL org.opencontainers.image.source="https://github.com/thespad/docker-dive"
LABEL org.opencontainers.image.url="https://github.com/thespad/docker-dive"
ARG GOCACHE=/tmp \
GOOS=linux \
CGO_ENABLED=0
RUN \
apk add --update --no-cache --virtual=build-dependencies \
go && \
apk add -U --upgrade --no-cache \
grep && \
echo "**** install docker cli ****" && \
mkdir -p /tmp/docker && \
if [ -z ${DOCKER_RELEASE+x} ]; then \
DOCKER_RELEASE=$(curl -sX GET "https://api.github.com/repos/docker/cli/tags" | \
jq -r '.[] | .name' | grep -P -v -m 1 '(rc|beta|alpha)' | sed 's/^.//'); \
fi && \
ARCH=$(uname -m | sed 's/armv7l/armhf/') && \
curl -s -o \
/tmp/docker.tar.gz -L \
"https://download.docker.com/linux/static/stable/${ARCH}/docker-${DOCKER_RELEASE}.tgz" && \
tar xf \
/tmp/docker.tar.gz -C \
/tmp/docker/ --strip-components=1 && \
mv /tmp/docker/docker /usr/local/bin && \
echo "**** installed docker cli version ${DOCKER_RELEASE} ****" && \
echo "**** install dive ****" && \
mkdir -p /tmp/dive && \
if [ -z ${APP_VERSION+x} ]; then \
APP_VERSION=$(curl -sX GET "https://api.github.com/repos/wagoodman/dive/releases/latest" \
| awk '/tag_name/{print $4;exit}' FS='[""]'); \
fi && \
curl -s -o \
/tmp/dive.tar.gz -L \
"https://github.com/wagoodman/dive/archive/${APP_VERSION}.tar.gz" && \
tar xf \
/tmp/dive.tar.gz -C \
/tmp/dive/ --strip-components=1
COPY patch/image_archive.go /tmp/dive/dive/image/docker/image_archive.go
RUN \
cd /tmp/dive && \
go build -o /usr/local/bin/dive && \
echo "**** installed dive version ${APP_VERSION} ****" && \
echo "**** clean up ****" && \
apk del --purge \
build-dependencies && \
rm -rf \
/tmp/* \
/root/go
FROM scratch
# set version label
ARG BUILD_DATE
ARG VERSION
ARG APP_VERSION
LABEL build_version="Version:- ${VERSION} Build-date:- ${BUILD_DATE}"
LABEL maintainer="thespad"
LABEL org.opencontainers.image.source="https://github.com/thespad/docker-dive"
LABEL org.opencontainers.image.url="https://github.com/thespad/docker-dive"
LABEL org.opencontainers.image.description="A tool for exploring a docker image, layer contents, and discovering ways to shrink the size of your Docker/OCI image"
LABEL org.opencontainers.image.authors="thespad"
COPY --from=build-stage /usr/local/bin/dive /
COPY --from=build-stage /usr/local/bin/docker /usr/local/bin/docker
ENTRYPOINT ["/dive"]