This repository was archived by the owner on Dec 16, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathDockerfile.libgit2-only
More file actions
68 lines (50 loc) · 1.47 KB
/
Dockerfile.libgit2-only
File metadata and controls
68 lines (50 loc) · 1.47 KB
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
# This Dockerfile builds and packages libgit2 only (not linked with openssl and libssh2)
ARG BASE_VARIANT=alpine
ARG GO_VERSION=1.19
ARG XX_VERSION=1.1.2
FROM --platform=$BUILDPLATFORM tonistiigi/xx:${XX_VERSION} AS xx
FROM --platform=$BUILDPLATFORM ${BASE_VARIANT} AS build-base
RUN apk add --no-cache \
bash \
curl \
build-base \
linux-headers \
perl \
cmake \
python3-dev \
pkgconfig \
gcc \
musl-dev \
clang \
lld
COPY --from=xx / /
FROM build-base AS build-cross
ARG TARGETPLATFORM
RUN xx-apk add --no-cache \
build-base \
pkgconfig \
gcc \
musl-dev \
clang \
lld \
llvm \
linux-headers
WORKDIR /build
COPY hack/static.sh .
ENV CC=xx-clang
ENV CXX=xx-clang++
RUN ./static.sh build_libgit2_only
# trimmed removes all non necessary files (i.e. openssl binary).
FROM build-cross AS trimmed
ARG TARGETPLATFORM
RUN mkdir -p /trimmed/usr/local/$(xx-info triple)/ && \
mkdir -p /trimmed/usr/local/$(xx-info triple)/share
RUN cp -r /usr/local/$(xx-info triple)/lib/ /trimmed/usr/local/$(xx-info triple)/ && \
cp -r /usr/local/$(xx-info triple)/include/ /trimmed/usr/local/$(xx-info triple)/
FROM scratch as libs-arm64
COPY --from=trimmed /trimmed/ /
FROM scratch as libs-amd64
COPY --from=trimmed /trimmed/ /
FROM scratch as libs-armv7
COPY --from=trimmed /trimmed/ /
FROM libs-$TARGETARCH$TARGETVARIANT as libs