-
Notifications
You must be signed in to change notification settings - Fork 2
/
Dockerfile
90 lines (74 loc) · 3.38 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
82
83
84
85
86
87
88
89
90
# docker build --platform=linux/riscv64 -t tonistiigi/docker:riscv .
# docker run -it --privileged tonistiigi/docker:riscv
FROM tonistiigi/xx:riscv-toolchain AS riscv-gnu
RUN apt-get update && apt-get install -y git autoconf libtool make curl bzip2 ca-certificates
FROM riscv-gnu AS libseccomp
WORKDIR /src
RUN git clone git://github.com/seccomp/libseccomp && cd libseccomp && \
git fetch origin pull/134/head && \
git checkout FETCH_HEAD
WORKDIR /src/libseccomp
RUN autoreconf -fis && \
./configure --host=riscv64-linux --prefix=/usr/riscv64-linux-gnu/riscv64-buildroot-linux-gnu/sysroot/usr/ && \
make && make install && \
mkdir /out && \
cp -a /usr/riscv64-linux-gnu/riscv64-buildroot-linux-gnu/sysroot/usr/lib/libseccomp* /out/
FROM libseccomp AS crun
RUN apt-get install -y pkg-config python3 go-md2man
RUN apt-get install -y libcap-dev:riscv64 libyajl-dev:riscv64
COPY crun.diff /tmp/
WORKDIR /src
RUN git clone git://github.com/giuseppe/crun && cd crun && \
git checkout 1c9ffac294f232a630d38d988353736f0fd42408 && \
git apply /tmp/crun.diff
WORKDIR /src/crun
# yuck
RUN ./autogen.sh && \
ln -s /usr/include/yajl /usr/riscv64-linux-gnu/riscv64-buildroot-linux-gnu/sysroot/usr/include/yajl && \
ln -s /usr/include/sys/capability.h /usr/riscv64-linux-gnu/riscv64-buildroot-linux-gnu/sysroot/usr/include/sys/capability.h && \
PKG_CONFIG_PATH=/usr/lib/riscv64-linux-gnu/pkgconfig LDFLAGS="-L/usr/lib/riscv64-linux-gnu" ./configure --host=riscv64-linux && \
make
FROM --platform=$BUILDPLATFORM alpine AS runc
RUN mkdir /out && cd out && ln -s crun runc
FROM --platform=$BUILDPLATFORM tonistiigi/xx:golang-riscv AS docker
RUN apk add --no-cache coreutils
RUN git clone git://github.com/tonistiigi/docker-cli -b update-vendor /go/src/github.com/docker/cli
ARG TARGETPLATFORM
WORKDIR /go/src/github.com/docker/cli
RUN sh ./scripts/build/binary
FROM --platform=$BUILDPLATFORM tonistiigi/xx:golang-riscv AS containerd
RUN git clone git://github.com/tonistiigi/containerd -b update-vendor --depth=1 /go/src/github.com/containerd/containerd
ARG TARGETPLATFORM
WORKDIR /go/src/github.com/containerd/containerd
RUN mkdir out && go build -o /out/ctr ./cmd/ctr && \
go build -o /out/containerd-shim ./cmd/containerd-shim && \
go build -o /out/containerd -tags no_btrfs ./cmd/containerd
FROM --platform=$BUILDPLATFORM tonistiigi/xx:golang-riscv AS dockerd
RUN git clone git://github.com/tonistiigi/docker /go/src/github.com/docker/docker && \
cd /go/src/github.com/docker/docker && \
git checkout eb8507f75da8c2939c7ec84bf87d9b821bc77a8f
ARG TARGETPLATFORM
WORKDIR /go/src/github.com/docker/docker
RUN go build -o /out/dockerd -tags "exclude_disk_quota exclude_graphdriver_devicemapper" ./cmd/dockerd/
FROM scratch AS dist
COPY --from=libseccomp /out/ /lib/
COPY --from=crun /src/crun/crun /bin/
COPY --from=runc /out/ /bin/
COPY --from=docker /go/src/github.com/docker/cli/build/docker /bin/docker
COPY --from=containerd /out/ /bin/
COPY --from=dockerd /out/ /bin/
FROM tonistiigi/debian:riscv AS main
RUN apt-get update && \
apt-get install -y --no-install-recommends \
libyajl2 libcap2 iptables ca-certificates && \
update-alternatives --set iptables /usr/sbin/iptables-legacy
COPY --from=dist / /usr/
VOLUME /var/lib/docker
FROM main AS crun-demo
RUN apt-get install -y vim
COPY --from=tonistiigi/hello:riscv / /demo/rootfs/
RUN cd /demo/ && crun spec
WORKDIR /demo
FROM main AS dind
ENTRYPOINT ["dockerd"]
FROM main