-
Notifications
You must be signed in to change notification settings - Fork 15
/
Dockerfile-debian.template
77 lines (73 loc) · 2.5 KB
/
Dockerfile-debian.template
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
FROM debian:bookworm-slim
RUN set -eux; \
apt-get update; \
apt-get install -y --no-install-recommends \
ca-certificates \
curl \
dnsutils \
git \
openssh-client \
unzip \
; \
rm -rf /var/lib/apt/lists/*
# Create a minimal runtime environment for executing AOT-compiled Dart code
# with the smallest possible image size.
# usage: COPY --from=dart:xxx /runtime/ /
# uses hard links here to save space
RUN set -eux; \
case "$(dpkg --print-architecture)" in \
amd64) \
TRIPLET="x86_64-linux-gnu" ; \
FILES="/lib64/ld-linux-x86-64.so.2" ;; \
armhf) \
TRIPLET="arm-linux-gnueabihf" ; \
FILES="/lib/ld-linux-armhf.so.3 \
/lib/arm-linux-gnueabihf/ld-linux-armhf.so.3";; \
arm64) \
TRIPLET="aarch64-linux-gnu" ; \
FILES="/lib/ld-linux-aarch64.so.1 \
/lib/aarch64-linux-gnu/ld-linux-aarch64.so.1" ;; \
*) \
echo "Unsupported architecture" ; \
exit 5;; \
esac; \
FILES="$FILES \
/etc/nsswitch.conf \
/etc/ssl/certs \
/usr/share/ca-certificates \
/lib/$TRIPLET/libc.so.6 \
/lib/$TRIPLET/libdl.so.2 \
/lib/$TRIPLET/libm.so.6 \
/lib/$TRIPLET/libnss_dns.so.2 \
/lib/$TRIPLET/libpthread.so.0 \
/lib/$TRIPLET/libresolv.so.2 \
/lib/$TRIPLET/librt.so.1"; \
for f in $FILES; do \
dir=$(dirname "$f"); \
mkdir -p "/runtime$dir"; \
cp --archive --link --dereference --no-target-directory "$f" "/runtime$f"; \
done
ENV DART_SDK /usr/lib/dart
ENV PATH $DART_SDK/bin:/root/.pub-cache/bin:$PATH
WORKDIR /root
RUN set -eux; \
case "$(dpkg --print-architecture)" in \
amd64) \
DART_SHA256={{DART_SHA256_X64}}; \
SDK_ARCH="x64";; \
armhf) \
DART_SHA256={{DART_SHA256_ARM}}; \
SDK_ARCH="arm";; \
arm64) \
DART_SHA256={{DART_SHA256_ARM64}}; \
SDK_ARCH="arm64";; \
esac; \
SDK="dartsdk-linux-${SDK_ARCH}-release.zip"; \
BASEURL="https://storage.googleapis.com/dart-archive/channels"; \
URL="$BASEURL/{{DART_CHANNEL}}/release/{{DART_VERSION}}/sdk/$SDK"; \
echo "SDK: $URL" >> dart_setup.log ; \
curl -fLO "$URL"; \
echo "$DART_SHA256 *$SDK" \
| sha256sum --check --status --strict -; \
unzip "$SDK" && mv dart-sdk "$DART_SDK" && rm "$SDK" \
&& chmod 755 "$DART_SDK" && chmod 755 "$DART_SDK/bin";