forked from fermyon/spin
-
Notifications
You must be signed in to change notification settings - Fork 0
/
e2e-tests.Dockerfile
88 lines (71 loc) · 4.41 KB
/
e2e-tests.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
FROM ubuntu:22.04
ARG BUILD_SPIN=false
ARG FETCH_SPIN=true
ARG SPIN_VERSION=canary
WORKDIR /root
RUN apt-get update && apt-get install -y wget sudo xz-utils gcc git pkg-config redis clang libicu-dev docker.io
# nodejs
RUN curl -fsSL https://deb.nodesource.com/setup_16.x | sudo -E bash -
RUN apt-get install -y nodejs npm
# golang
RUN wget https://go.dev/dl/go1.20.1.linux-amd64.tar.gz && \
rm -rf /usr/local/go && tar -C /usr/local -xzf go1.20.1.linux-amd64.tar.gz
ENV PATH="$PATH:/usr/local/go/bin"
# tinygo
RUN wget https://github.com/tinygo-org/tinygo/releases/download/v0.27.0/tinygo_0.27.0_amd64.deb && \
sudo dpkg -i tinygo_0.27.0_amd64.deb && \
tinygo env
# zig
RUN wget https://ziglang.org/download/0.10.0/zig-linux-x86_64-0.10.0.tar.xz && \
tar -xf zig-linux-x86_64-0.10.0.tar.xz
ENV PATH="$PATH:/root/zig-linux-x86_64-0.10.0"
# grain
RUN wget https://github.com/grain-lang/grain/releases/download/grain-v0.5.4/grain-linux-x64 && \
mv grain-linux-x64 /usr/local/bin/grain && chmod +x /usr/local/bin/grain
# # rust
ENV RUSTUP_HOME=/usr/local/rustup \
CARGO_HOME=/usr/local/cargo \
PATH=/usr/local/cargo/bin:$PATH
RUN url="https://static.rust-lang.org/rustup/dist/x86_64-unknown-linux-gnu/rustup-init"; \
wget "$url"; \
chmod +x rustup-init; \
./rustup-init -y --no-modify-path --default-toolchain 1.71 --default-host x86_64-unknown-linux-gnu; \
rm rustup-init; \
chmod -R a+w $RUSTUP_HOME $CARGO_HOME; \
rustup --version; \
cargo --version; \
rustc --version; \
rustup target add wasm32-wasi; \
rustup target add wasm32-unknown-unknown;
# swift
RUN wget https://github.com/swiftwasm/swift/releases/download/swift-wasm-5.8-SNAPSHOT-2023-02-24-a/swift-wasm-5.8-SNAPSHOT-2023-02-24-a-ubuntu22.04_x86_64.tar.gz && \
tar -xf swift-wasm-5.8-SNAPSHOT-2023-02-24-a-ubuntu22.04_x86_64.tar.gz
ENV PATH="$PATH:/root/swift-wasm-5.8-SNAPSHOT-2023-02-24-a/usr/bin"
## check versions
RUN tinygo version; \
go version; \
zig version; \
rustc --version; \
node --version; \
swift --version;
RUN if [ "${FETCH_SPIN}" = "true" ]; then \
wget https://github.com/fermyon/spin/releases/download/${SPIN_VERSION}/spin-${SPIN_VERSION}-linux-amd64.tar.gz && \
tar -xvf spin-${SPIN_VERSION}-linux-amd64.tar.gz && \
ls -ltr && \
mv spin /usr/local/bin/spin; \
fi
WORKDIR /e2e-tests
COPY . .
RUN printf '#!/bin/bash \n \
if [[ "$BUILD_SPIN" == "true" ]]; then \n \
echo "BUILD_SPIN is true. compiling spin" \n \
cargo build --release \n \
fi \n\n \
cargo test spinup_tests --features e2e-tests --no-fail-fast -- --nocapture \n \
' > /usr/local/bin/entrypoint.sh
RUN chmod +x /usr/local/bin/entrypoint.sh
RUN if [ "${FETCH_SPIN}" = "true" ] || [ "${BUILD_SPIN}" = "true" ]; then \
spin --version; \
fi
ENV PATH=/from-host/target/debug:/from-host/target/release:$HOME/.cargo/bin:$PATH
CMD /usr/local/bin/entrypoint.sh