-
Notifications
You must be signed in to change notification settings - Fork 1
/
Dockerfile
44 lines (28 loc) · 1.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
FROM rust:alpine3.17 AS builder
# Set the environment variables for pkg-config
ENV export PKG_CONFIG_SYSROOT_DIR=/usr/lib
ENV export PKG_CONFIG_LIBDIR=/usr/lib/pkgconfig
# Instale as dependências necessárias, incluindo o pacote libstdc++.
RUN apk add --no-cache g++ libstdc++ musl-dev zeromq-dev pkgconfig
WORKDIR /app
COPY ./ .
# Adicione a configuração ao arquivo cargo/config.toml
RUN mkdir -p .cargo && \
echo '[target.x86_64-unknown-linux-musl]' >> .cargo/config.toml && \
echo 'rustflags = ["-C", "target-feature=-crt-static"]' >> .cargo/config.toml
RUN rustup target add x86_64-unknown-linux-musl
RUN cargo build --release --target x86_64-unknown-linux-musl
RUN chmod +x start.sh
####################################################################################################
## Final image
####################################################################################################
FROM alpine:3.17
WORKDIR /code
# Install runtime dependencies for ZeroMQ
RUN apk add --no-cache libzmq
# Copy our build
COPY --from=builder /app/start.sh /usr/local/bin/
COPY --from=builder /app/target/x86_64-unknown-linux-musl/release/book /usr/local/bin/
COPY --from=builder /app/target/x86_64-unknown-linux-musl/release/tick /usr/local/bin/
COPY --from=builder /app/target/x86_64-unknown-linux-musl/release/full /usr/local/bin/
ENTRYPOINT ["/bin/sh", "/usr/local/bin/start.sh"]