This repository has been archived by the owner on Oct 4, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathDockerfile.bootstrap
211 lines (168 loc) · 6.76 KB
/
Dockerfile.bootstrap
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
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
FROM debian:buster-slim as stage0
ARG vDENO=1.27.0
ARG GITHUB_TOKEN
ENV GITHUB_TOKEN=$GITHUB_TOKEN
SHELL ["/bin/bash", "-c"]
RUN apt-get update
RUN apt-get install --yes curl unzip
RUN \
case $(uname -m) in \
x86_64) \
URL=https://github.com/denoland/deno/releases/download/v$vDENO/deno-x86_64-unknown-linux-gnu.zip;; \
aarch64) \
URL=https://github.com/LukeChannings/deno-arm64/releases/download/v$vDENO/deno-linux-arm64.zip;; \
*) \
echo "Unsupported architecture: $(uname -m)"; exit 1;; \
esac; \
curl -Lo deno.zip "$URL"
RUN mkdir -p /opt/deno.land/v$vDENO/bin
RUN unzip deno.zip -d /opt/deno.land/v$vDENO/bin
ADD cli /cli
WORKDIR /cli
RUN /opt/deno.land/v$vDENO/bin/deno compile \
--allow-read --allow-write=/opt --allow-net --allow-run --allow-env \
--import-map=/cli/import-map.json \
--unstable \
--output tea \
src/app.ts
#FIXME: $VERSION not currently being set.
RUN source <(./tea -Eds) \
&& /bin/mkdir -p /opt/tea.xyz/v$VERSION/bin \
&& /bin/mv tea /opt/tea.xyz/v$VERSION/bin \
&& cd /opt/tea.xyz && /bin/ln -s v$VERSION 'v*'
#------------------------------------------------------------------------------
FROM debian:buster-slim as stage1
ARG GITHUB_TOKEN
ENV GITHUB_TOKEN=$GITHUB_TOKEN
WORKDIR /opt/tea.xyz/var/pantry
COPY --from=stage0 /opt /opt
COPY --from=stage0 /cli/src src
COPY --from=stage0 /cli /cli
RUN ln -s /opt/tea.xyz/'v*'/bin/tea /usr/local/bin/tea
# make tea think these are already installed
RUN \
for x in \
llvm.org/v14.0.0 \
gnu.org/make/v4.0.0 \
python.org/v3.0.0 \
cmake.org/v3.0.0 \
ninja-build.org/v1.0.0 \
curl.se/v6.0.0 \
openssl.org/v1.1.0 \
perl.org/v5.0.0 \
zlib.net/v1.0.0 \
tea.xyz/gx/cc/v0.1.0 \
; \
do \
mkdir -p /opt/$x; \
touch /opt/$x/trick-tea-is-installed; \
done
RUN apt-get update
RUN apt-get install --yes make cmake ninja-build python3 clang perl patchelf curl
ADD pantry.core/projects/llvm.org projects/llvm.org
ADD pantry.core/projects/deno.land projects/deno.land
ADD pantry.core/scripts/build.plumbing.ts scripts/build.plumbing.ts
ADD pantry.core/scripts/fetch.ts scripts/fetch.ts
ADD pantry.core/scripts/brewkit scripts/brewkit
ADD pantry.core/scripts/build scripts/build
ADD pantry.core/scripts/utils scripts/utils
ADD pantry.core/import-map.json import-map.json
ADD cli/scripts/repair.ts scripts
ADD pantry.core/README.md README.md
RUN mkdir .git
# ^^ trick tea into finding SRCROOT
# tea.xyz/gx/cc
ADD pantry.core/projects/tea.xyz/gx/cc projects/tea.xyz/gx/cc
RUN scripts/build.plumbing.ts tea.xyz/gx/cc
# gnu.org/m4
ADD pantry.core/projects/gnu.org/m4 projects/gnu.org/m4
ADD pantry.core/projects/sourceware.org/bzip2 projects/sourceware.org/bzip2
ADD pantry.core/projects/darwinsys.com/file projects/darwinsys.com/file
ADD pantry.extra/projects/nixos.org/patchelf projects/nixos.org/patchelf
ADD pantry.core/projects/tukaani.org/xz projects/tukaani.org/xz
ADD pantry.core/projects/gnu.org/make projects/gnu.org/make
ADD pantry.core/projects/gnu.org/tar projects/gnu.org/tar
ADD pantry.core/projects/zlib.net projects/zlib.net
RUN scripts/build.plumbing.ts gnu.org/m4
# gnu.org/make
ADD pantry.core/projects/freedesktop.org/pkg-config projects/freedesktop.org/pkg-config
RUN scripts/build.plumbing.ts gnu.org/make
# freedesktop.org/pkg-config
RUN scripts/build.plumbing.ts freedesktop.org/pkg-config
# invisible-island.net/ncurses
ADD pantry.core/projects/invisible-island.net/ncurses projects/invisible-island.net/ncurses
RUN scripts/build.plumbing.ts invisible-island.net/ncurses
# gnu.org/readline
ADD pantry.core/projects/gnu.org/readline projects/gnu.org/readline
RUN scripts/build.plumbing.ts gnu.org/readline
# zlib.net
RUN scripts/build.plumbing.ts zlib.net
# sourceware.org/bzip2
RUN scripts/build.plumbing.ts sourceware.org/bzip2
# sourceware.org/libffi
ADD pantry.core/projects/sourceware.org/libffi projects/sourceware.org/libffi
RUN scripts/build.plumbing.ts sourceware.org/libffi
# libexpat.github.io
ADD pantry.core/projects/libexpat.github.io projects/libexpat.github.io
RUN scripts/build.plumbing.ts libexpat.github.io
# bytereef.org/mpdecimal
ADD pantry.core/projects/bytereef.org/mpdecimal projects/bytereef.org/mpdecimal
RUN scripts/build.plumbing.ts bytereef.org/mpdecimal
# tukaani.org/xz
RUN scripts/build.plumbing.ts tukaani.org/xz
# sqlite.org
ADD pantry.core/projects/sqlite.org projects/sqlite.org
RUN scripts/build.plumbing.ts sqlite.org
# llvm.org
ADD pantry.core/projects/cmake.org projects/cmake.org
ADD pantry.core/projects/ninja-build.org projects/ninja-build.org
ADD pantry.core/projects/openssl.org projects/openssl.org
ADD pantry.core/projects/python.org projects/python.org
ADD pantry.core/projects/curl.se projects/curl.se
RUN scripts/build.plumbing.ts llvm.org
# gnome.org/libxml2
ADD pantry.extra/projects/gnome.org/libxml2 projects/gnome.org/libxml2
RUN scripts/build.plumbing.ts gnome.org/libxml2
# gnu.org/gettext
ADD pantry.core/projects/gnu.org/gettext projects/gnu.org/gettext
RUN scripts/build.plumbing.ts gnu.org/gettext
# git-scm.org
ADD pantry.core/projects/git-scm.org projects/git-scm.org
ADD pantry.core/projects/perl.org projects/perl.org
RUN scripts/build.plumbing.ts git-scm.org
# openssl.org
RUN scripts/build.plumbing.ts openssl.org
# curl.se
RUN scripts/build.plumbing.ts curl.se
# tea.xyz
ADD pantry.core/projects/tea.xyz projects/tea.xyz
RUN scripts/build.plumbing.ts tea.xyz
# nixos.org/patchelf
RUN scripts/build.plumbing.ts nixos.org/patchelf
# darwinsys.com/file
RUN scripts/build.plumbing.ts darwinsys.com/file
RUN scripts/repair.ts deno.land tea.xyz
RUN cd /opt && rm -rf \
llvm.org/v14.0.0 \
gnu.org/make/v4.0.0 \
python.org \
cmake.org \
ninja-build.org \
gnu.org/m4 \
curl.se/v6.0.0 \
openssl.org/v1.1.0 \
perl.org
RUN find /opt -name src | xargs rm -rf
RUN rm -rf /opt/tea.xyz/var/www
#------------------------------------------------------------------------------
FROM debian:buster-slim as stage2
COPY --from=stage1 /opt /opt
ADD pantry.core /opt/tea.xyz/var/pantry
RUN \
ln -s /opt/tea.xyz/v'*'/bin/tea /usr/local/bin/tea && \
apt-get update && \
apt-get install --yes libc-dev libstdc++-8-dev libgcc-8-dev && \
#FIXME for opening tarballs
apt-get install --yes bzip2 xz-utils && \
# required on aarch64 by `ghcup`
apt-get --yes install libnuma1