optimize the production dockerfile to produce a 2.5MB image
This commit is contained in:
parent
7a0b197dc6
commit
5fbb8fdc9c
|
@ -23,3 +23,7 @@ sha2 = "0.10.8"
|
|||
static_dir = "0.2.0"
|
||||
tokio = { version = "1.32.0", features = ["rt", "macros", "rt-multi-thread"] }
|
||||
warp = "0.3.6"
|
||||
|
||||
[profile.release]
|
||||
opt-level = 'z'
|
||||
lto = true
|
||||
|
|
|
@ -4,10 +4,13 @@ FROM rust:alpine as builder
|
|||
WORKDIR /opt/build
|
||||
COPY . .
|
||||
|
||||
RUN apk add --no-cache musl-dev upx
|
||||
|
||||
RUN cargo b -r
|
||||
RUN strip target/release/filed && upx --best target/release/filed
|
||||
|
||||
# --- deploy ---
|
||||
FROM alpine
|
||||
FROM busybox:musl
|
||||
|
||||
COPY --from=builder /opt/build/target/release/filed /bin/filed
|
||||
CMD [ "/bin/filed" ]
|
||||
|
|
Loading…
Reference in New Issue