-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDockerfile
98 lines (78 loc) · 2.2 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
91
92
93
94
95
96
97
# Use a Linux ARM64 base image
FROM arm64v8/ubuntu:latest AS arm64
# Print the architecture
RUN echo "Building for ARM64 architecture"
# Install necessary dependencies
RUN apt-get update && apt-get install -y \
build-essential \
cmake \
pkg-config \
libssl-dev \
zlib1g-dev \
libclang-dev \
clang \
curl \
&& rm -rf /var/lib/apt/lists/*
# Install Rust using apt-get
RUN curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y --default-toolchain none
ENV PATH="/root/.cargo/bin:${PATH}"
# Install Rust toolchain
RUN rustup toolchain install stable
RUN rustup default stable
# Set the work directory
WORKDIR /workspace
# Argument to specify plugins (space-separated list)
ARG PLUGINS
# Create the binaries directory
RUN mkdir -p /workspace/binaries/
# Install specified plugins and copy their binaries
RUN if [ -z "$PLUGINS" ]; then \
echo "Error: No plugins provided."; \
exit 1; \
else \
for plugin in $PLUGINS; do \
cargo install $plugin --target aarch64-unknown-linux-gnu; \
cp /root/.cargo/bin/$plugin /workspace/binaries/ || exit 1; \
done \
fi
# Set the entry point
CMD ["bash"]
# Use a Linux x86_64 base image
FROM ubuntu:latest AS x86_64
# Print the architecture
RUN echo "Building for x86_64 architecture"
# Install necessary dependencies
RUN apt-get update && apt-get install -y \
build-essential \
cmake \
pkg-config \
libssl-dev \
zlib1g-dev \
libclang-dev \
clang \
curl \
&& rm -rf /var/lib/apt/lists/*
# Install Rust using apt-get
RUN curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y --default-toolchain none
ENV PATH="/root/.cargo/bin:${PATH}"
# Install Rust toolchain
RUN rustup toolchain install stable
RUN rustup default stable
# Set the work directory
WORKDIR /workspace
# Argument to specify plugins (space-separated list)
ARG PLUGINS
# Create the binaries directory
RUN mkdir -p /workspace/binaries/
# Install specified plugins and copy their binaries
RUN if [ -z "$PLUGINS" ]; then \
echo "Error: No plugins provided."; \
exit 1; \
else \
for plugin in $PLUGINS; do \
cargo install $plugin --target x86_64-unknown-linux-gnu; \
cp /root/.cargo/bin/$plugin /workspace/binaries/ || exit 1; \
done \
fi
# Set the entry point
CMD ["bash"]