forked from ktock/container2wasm
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile.test
95 lines (78 loc) · 3.55 KB
/
Dockerfile.test
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
# syntax = docker/dockerfile:1.5
ARG BUILDX_VERSION=0.14.1
ARG DOCKER_VERSION=26.1.4
ARG WAMR_VERSION=2.0.0
ARG WASMEDGE_VERSION=0.14.0
ARG GOLANG_VERSION=1.22.3
ARG WASMER_VERSION=v4.2.5
ARG WASMTIME_VERSION=24.0.0
FROM docker:${DOCKER_VERSION}-dind AS dind
FROM docker/buildx-bin:${BUILDX_VERSION} AS buildx
FROM golang:1.22 AS wazero-test-dev
COPY ./tests/wazero /wazero
WORKDIR /wazero
RUN go build -o /out/wazero-test main.go
FROM golang:1.22 AS httphello-dev
COPY ./tests/httphello /httphello
WORKDIR /httphello
RUN go build -o /out/httphello main.go
FROM golang:1.22 AS c2w-net-proxy-test-dev
COPY ./tests/c2w-net-proxy-test /c2w-net-proxy-test
WORKDIR /c2w-net-proxy-test
RUN go build -o /out/c2w-net-proxy-test main.go
FROM golang:1.22 AS imagemounter-test-dev
COPY ./tests/imagemounter-test /imagemounter-test
WORKDIR /imagemounter-test
RUN go build -o /out/imagemounter-test main.go
FROM ubuntu:22.04
ARG BUILDX_VERSION
ARG DOCKER_VERSION
ARG WAMR_VERSION
ARG WASMEDGE_VERSION
ARG GOLANG_VERSION
ARG WASMER_VERSION
ARG WASMTIME_VERSION
RUN apt-get update && apt-get install -y ca-certificates iptables openssl pigz xz-utils curl wget
# install docker
ENV DOCKER_TLS_CERTDIR=/certs
RUN mkdir /certs /certs/client && chmod 1777 /certs /certs/client
COPY --from=dind /usr/local/bin/ /usr/local/bin/
COPY --from=buildx /buildx /usr/libexec/docker/cli-plugins/docker-buildx
VOLUME /var/lib/docker
# install wasmtime
RUN wget https://github.com/bytecodealliance/wasmtime/releases/download/v${WASMTIME_VERSION}/wasmtime-v${WASMTIME_VERSION}-x86_64-linux.tar.xz && \
tar -xvf wasmtime-v${WASMTIME_VERSION}-x86_64-linux.tar.xz && \
mv wasmtime-v${WASMTIME_VERSION}-x86_64-linux/wasmtime /usr/local/bin/
# install wamr
RUN wget https://github.com/bytecodealliance/wasm-micro-runtime/releases/download/WAMR-${WAMR_VERSION}/iwasm-${WAMR_VERSION}-x86_64-ubuntu-22.04.tar.gz && \
tar -C /usr/local/bin/ -zxvf iwasm-${WAMR_VERSION}-x86_64-ubuntu-22.04.tar.gz
RUN wget https://github.com/bytecodealliance/wasm-micro-runtime/releases/download/WAMR-${WAMR_VERSION}/wamrc-${WAMR_VERSION}-x86_64-ubuntu-22.04.tar.gz && \
tar -C /usr/local/bin/ -zxvf wamrc-${WAMR_VERSION}-x86_64-ubuntu-22.04.tar.gz
# install wasmer
RUN curl https://get.wasmer.io -sSfL | sh -s ${WASMER_VERSION}
ENV WASMER_DIR="/root/.wasmer"
ENV WASMER_CACHE_DIR="$WASMER_DIR/cache"
ENV PATH="$WASMER_DIR/bin:$PATH:$WASMER_DIR/globals/wapm_packages/.bin"
# install wasmedge
RUN wget https://github.com/WasmEdge/WasmEdge/releases/download/${WASMEDGE_VERSION}/WasmEdge-${WASMEDGE_VERSION}-ubuntu20.04_x86_64.tar.gz && \
tar zxvf WasmEdge-${WASMEDGE_VERSION}-ubuntu20.04_x86_64.tar.gz && \
cp -R ./WasmEdge-${WASMEDGE_VERSION}-Linux/* /usr/local/
# install wazero
COPY --from=wazero-test-dev /out/wazero-test /usr/local/bin/
COPY --from=httphello-dev /out/httphello /usr/local/bin/
COPY --from=c2w-net-proxy-test-dev /out/c2w-net-proxy-test /usr/local/bin/
COPY --from=imagemounter-test-dev /out/imagemounter-test /usr/local/bin/
# install golang
RUN wget https://go.dev/dl/go${GOLANG_VERSION}.linux-amd64.tar.gz
RUN tar -C /usr/local -xzf go${GOLANG_VERSION}.linux-amd64.tar.gz
ENV PATH=$PATH:/usr/local/go/bin
# install container2wasm
# NOTE: integration test script also depends on this path.
COPY . /test/
WORKDIR /test/
RUN go build -o /usr/local/bin/ ./cmd/c2w
RUN go build -o /usr/local/bin/ ./cmd/c2w-net
RUN cd extras/c2w-net-proxy/ ; GOOS=wasip1 GOARCH=wasm go build -o /opt/c2w-net-proxy.wasm .
RUN cd extras/imagemounter/ ; GOOS=wasip1 GOARCH=wasm go build -o /opt/imagemounter.wasm .
ENTRYPOINT ["dockerd-entrypoint.sh"]
CMD []