-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
36 lines (24 loc) · 838 Bytes
/
Dockerfile
File metadata and controls
36 lines (24 loc) · 838 Bytes
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
FROM rust:latest AS builder
ENV CARGO_TARGET_X86_64_UNKNOWN_LINUX_MUSL_LINKER=musl-gcc
ENV RUSTFLAGS="-C target-feature=-crt-static"
WORKDIR /usr/src/app
RUN apt-get update && apt-get install -y \
build-essential \
pkg-config \
libssl-dev \
ca-certificates \
musl-tools # Add musl tools for cross-compilation
RUN rustup target add x86_64-unknown-linux-musl
COPY Cargo.toml Cargo.lock ./
RUN mkdir src && echo "fn main() {}" > src/main.rs
RUN cargo build --release --target x86_64-unknown-linux-musl
RUN rm -rf src
COPY . .
RUN cargo build --release --target x86_64-unknown-linux-musl
FROM frolvlad/alpine-glibc:latest
WORKDIR /app
RUN apk add --no-cache \
ca-certificates
COPY --from=builder /usr/src/app/target/x86_64-unknown-linux-musl/release/stabuse .
EXPOSE 8080
CMD ["./stabuse"]