forked from Gelbpunkt/gateway-proxy
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile
37 lines (28 loc) · 962 Bytes
/
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
FROM docker.io/library/alpine:edge AS builder
ARG SIMD=1
RUN apk upgrade && \
apk add curl gcc g++ musl-dev cmake make && \
curl -sSf https://sh.rustup.rs | sh -s -- --profile minimal --default-toolchain nightly -y
WORKDIR /build
COPY Cargo.toml Cargo.lock ./
RUN mkdir src/
RUN echo 'fn main() {}' > ./src/main.rs
RUN source $HOME/.cargo/env && \
if [ "$SIMD" == '0' ]; then \
cargo build --release --no-default-features --features no-simd; \
else \
cargo build --release; \
fi
RUN rm -f target/release/deps/gateway_proxy*
COPY ./src ./src
RUN source $HOME/.cargo/env && \
if [ "$TARGET_CPU" == 'x86-64' ]; then \
cargo build --release --no-default-features --features no-simd; \
else \
cargo build --release; \
fi && \
cp target/release/gateway-proxy /gateway-proxy && \
strip /gateway-proxy
FROM scratch
COPY --from=builder /gateway-proxy /gateway-proxy
CMD ["./gateway-proxy"]