-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDockerfile
60 lines (50 loc) · 1.84 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
FROM alpine:latest as git-alpine
RUN apk add git
# Newest UPX not yet in Alpine
RUN apk add xz \
&& wget -qO- https://github.com/upx/upx/releases/download/v3.95/upx-3.95-amd64_linux.tar.xz | tar x -J --strip-components=1 -C /tmp/
# UPX all the libraries and execs except musl and libpcre2-posix
RUN /tmp/upx --brute --best \
$(realpath \
/lib/libcrypto.so.43 \
/lib/libssl.so.45 \
/usr/lib/libcurl.so.4 \
/usr/lib/libpcre2-8.so.0 \
/usr/lib/libnghttp2.so.14 \
/usr/lib/libssh2.so.1 \
/usr/libexec/git-core/git \
/usr/libexec/git-core/git-clone \
/usr/libexec/git-core/git-remote-http \
/usr/libexec/git-core/git-remote-https \
)
######################################################
# BUILD MINIMAL GIT IMAGE
######################################################
FROM alpine:latest
LABEL maintainer="Wilmar den Ouden <[email protected]>"
# Copy libraries to /lib
COPY --from=git-alpine \
"/lib/ld-musl-x86_64.so.1" \
/lib/libcrypto.so.43 \
/lib/libssl.so.45 \
/lib/
# Copy libraries to /usr/lib
COPY --from=git-alpine \
/usr/lib/libcurl.so.4 \
/usr/lib/libpcre2-8.so.0 \
/usr/lib/libpcre2-posix.so.2 \
/usr/lib/libnghttp2.so.14 \
/usr/lib/libssh2.so.1 \
/usr/lib/
# Copy git executables to /usr/libexec/git-core/
COPY --from=git-alpine \
/usr/libexec/git-core/git \
/usr/libexec/git-core/git-clone \
/usr/libexec/git-core/git-remote-http \
/usr/libexec/git-core/git-remote-https \
/usr/libexec/git-core/
# Copy CA certs for HTTPS clone
COPY --from=git-alpine /etc/ssl/certs/ca-certificates.crt /etc/ssl/certs/ca-certificates.crt
# Copy git templates dir so it doesn't show a warning
COPY --from=git-alpine /usr/share/git-core/templates /usr/share/git-core/templates
ENTRYPOINT ["/usr/libexec/git-core/git", "clone"]